Previous Topic

Next Topic

Deleting a table

When you delete a table from a database, the table information is removed from the database dictionary and the table data and index files are deleted from disk. The delete table operation can be reversed only when used under transaction control. Without transaction control, a delete table operation will delete the data and index files and the table data will be lost. Delete a table from a database by calling ctdbDeleteTable().

/* delete MyTable from current database */
if (ctdbDeleteTable(hDatabase, “MyTable”, NULL) != CTDBRET_OK)
   printf(“Delete table failed\n”);

ctdbDeleteTable() takes as parameters a database handle, the table name, and the table password. Set the password parameter to NULL if a table was created without a password.