Deleting a Database
From InterBase
Go Up to Working with Databases
To remove a database from the system if it is no longer needed, use isc_drop_database
(). This function permanently wipes out a database, erasing its data, metadata, and all of its supporting files, such as secondary files, shadow files, and write-ahead log files.
A database can only be deleted if it is previously attached with a call to isc_attach_database
(). The call to isc_attach_database()
establishes a database handle for the database. That handle must be passed in the call to isc_drop_database
().
For example, the following code deletes the database pointed to by the database handle, db1
:
#include <ibase.h>
. . .
isc_db_handle db1;
char *str = "employee.ib";
ISC_STATUS status_vector[20];
. . .
/* Set database handle to zero before attaching to a database. */
db1 = 0L;
/* Attach to the database. */
isc_attach_database(status_vector, strlen(str), str, &db1, 0, NULL);
if (status_vector[0] == 1 && status_vector[1]){
error_exit();
}
isc_drop_database(status_vector, &db1);
if (status_vector[0] == 1 && status_vector[1]){
error_exit();
}
. . .