ctdbRemoveTable
Removes any c-tree table.
Declaration
CTDBRET ctdbDECL ctdbRemoveTable(CTHANDLE Handle);
Description
The ctdbRemoveTable() function allows any table data file and its associated index files to be deleted from disk, including tables that are not members of a database / not created in a CTSESSION_CTDB or CTSESSION_SQL session. This function is intended for CTSESSION_CTREE tables, which are not a part of a database.
If the table was opened under a database handle, the table is closed and ctdbDeleteTable() is called. The handle must be active.
If the table was opened under a database handle, meaning that the provided table handle is "active", this function closes that table and then calls ctdbDeleteTable() to delete the files. If the table handle is not active, the table is opened exclusive by this function and then deleted. In this case, you must first set the path, file extension, and password for the table handle before calling ctdbRemoveTable(). See ctdbSetTablePath(), ctdbSetTableExtension(), and ctdbSetTablePassword(). Note that it is simpler to delete the table and index files using ctdbDeleteTable(), so use that function if you can.
V11.5 and Later
In V11.5 and later, ctdbRemoveTable() expects the table handle to have the path, password, file extension, and name information. A non-active table handle does not have this information. (Close and create clean up and deactivate the table handle.) While the path, password and file extensions can be set by the FairCom DB API API, there is no function to set the name. As a result, ctdbRemoveTable() does not work on non-active tables and could have failed with various errors.
This function will now fail immediately and return error CTDBRET_NOTACTIVE (4012) if the table handle is not active.
ctdbRemoveTable() deletes a c-tree data file and associated index files from disk. If the table was opened under a database handle, the table is closed and ctdbDeleteTable() is called. The handle must be active.
Compatibility Change: This modification is a change in behavior.
Return
Value |
Symbolic Constant |
Explanation |
---|---|---|
0 |
CTDBRET_OK |
ctdbRemoveTable() returns CTDBRET_OK on success or FairCom DB API SDK error code on failure. |
|
CTDBRET_NOTACTIVE |
If the table is not active, ctdbRemoveTable() returns this error and fails immediately. |
See FairCom DB API Errors and Return Values for a complete listing of valid FairCom DB APIerror codes and return values.
Example
/* delete a FairCom DB API table */
if (ctdbRemoveTable(MyHandle) != CTDBRET_OK)
printf("ctdbRemoveTable Failed!\n");
See also
ctdbDeleteTable()