Dropping a table under transaction controlAn extra level of data integrity may be achieved when you drop a table from a database under transaction control. When the transaction is committed the changes to the database dictionary data for the table is committed to disk. If the transaction is aborted, the dictionary data for the table is automatically restored to the database dictionary. The code fragment below shows how to drop an existing table under transaction control. No error checking is included in the sample code: /* start a transaction */ ctdbBegin(hDatabase); /* drop MyTable from current database */ if (ctdbDropTable(hDatabase, “MyTable”) != CTDBRET_OK) {
printf(“Drop table failed\n”); ctdbAbort(hDatabase); } else {
printf(“Drop table\n”); ctdbCommit(hDatabase); |
|||