TEntityConnection.CreateDatabase Method

Create all database objects for the specified meta model.




procedure CreateDatabase(const Model: TMetaModel = nil; const Options: TDatabaseModifyOptions = []);

Specifies the database creation options.


Call CreateDatabase to automatically create all database objects needed for the specified meta model. When executing the method, the connection has to be already connected and no active transactions have to be present. Otherwise, the appropriate exceptions will be raised.

Calling CreateDatabase generates a set of DDL expressions depending on the specified meta model and executes the expressions one by one using the ExecuteSQL method.

The MetaModel parameter specifies the meta model for which the database need to be created. When MetaModel is set to Nil, the default connection meta model specified by the DefaultModelName property is used.

The Options parameter specifies additional options of the database creation process. When the moCommitEachStatement is specified in Options, each DDL statement executed within a separate transaction. Otherwise, the only transaction starts in the beginning of the method execution and commits after all statements executed. When the moIgnoreErrors is specified in options, then when error is occurred during the method execution, no error message will be shown and the execution continued. Otherwise, the execution will be stopped and the appropriate exception raised.

To drop all database objects used by the meta model, the DropDatabase method is used.

See Also

© 1997-2018 Devart. All Rights Reserved. Request Support DAC Forum Provide Feedback