TEntityConnection.DropDatabase Method

Drop all database objects used by the specified meta model.




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

Specifies the database deletion options.


Call DropDatabase to automatically drop all database objects used by 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 DropDatabase 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 dropped. 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 deletion 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 is shown and the execution continued. Otherwise, the execution is stopped and the appropriate exception raised.

To create all database objects needed for the meta model, the CreateDatabase method is used.

See Also

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