<< ibec_ShutdownDatabase | IBEBlock | ibec_CreateConnection >>

ibec_DropDatabase

ibec_DropDatabase replaces the DROP DATABASE command within IBEBlocks. DROP DATABASE is still available for compatibility.

Syntax

 function ibec_DropDatabase(DatabaseType : integer; DatabaseProps : variant) : variant;

ibec_Database attempts to drop a database using the specified properties or connection handle and returns 0 if successful. Otherwise it returns NULL and raises an exception.

Note: It is impossible to drop the default connection using ibec_DropDatabase, an exception will be raised.

Parameters

DatabaseTypeType of database to be dropped. Currently only __ctFirebird/__ctDatabase is supported.
DatabasePropsList of the database properties, delimited with semicolon. Alternatively you can use a connection handle created with the ibec_CreateConnection or the ibec_CreateDatabase functions. The following properties are available:
DBName=<path_to_a_database>A new database file specification; file naming conventions are platform-specific.
ClientLib=<path to client library>Client library file name. Default: gds32.dll.
User=<user_name>User name.
Password=<password>Password.

Example #1

 execute ibeblock
 as
 begin
  try
    Res = ibec_DropDatabase(__ctFirebird, 'DBName="localhost:d:\my databases\nydb.fba";
                           ClientLib="C:\Program Files\Firebird\bin\fbclient.dll"; 
                           User=SYSDBA; Password=masterkey');
    if (Res is not null) then
       ibec_ShowMessage('Database dropped successfully');
   except
   end;
 end;

Example #2

 execute ibeblock
 as
 begin
   MyConn = ibec_CreateConnection(__ctFirebird, 'DBName="localhost:d:\my databases\nydb.fba";
                                 ClientLib="C:\Program Files\Firebird\bin\fbclient.dll"; 
                                 User=SYSDBA; Password=masterkey');
   try
     Res = ibec_DropDatabase(__ctFirebird, MyConn);
     if (Res is not null) then
       ibec_ShowMessage('Database dropped successfully');
   except
   end;
 end;

See also:
Drop database