Deleting a table under transaction controlAn extra level of data integrity can be achieved when you delete a table from a database under transaction control. When the transaction is committed, the changes to the database dictionary data for the table are committed to disk and the table and index files are deleted from disk. If the transaction is aborted, the dictionary data for the table is automatically restored to the database dictionary and the original data and index files are restored to their original state. The code fragment below shows how to delete an existing table under transaction control. No error checking is included in the sample code: // start a transaction try {
// delete MyTable from current database CTString password; ADatabase.DeleteTable(“MyTable”, password);
ADatabase.Commit(); } {
// abort the transaction ADatabase.Abort(); printf(“Delete table failed with code %d\n”, err.GetErrorCode()); } |
|||