Product Documentation

c-treeDB API API for C

Previous Topic

Next Topic


Drop the table from the database.


CTDBRET ctdbDropTable(CTHANDLE Handle, pTEXT TableName)


ctdbDropTable() drops the table from the database, but does not delete the table or index files from disk. When a table is dropped, the allocated records, fields, index and segments are freed from memory.

  • Handle [in] the handle of the database that contains the table to be dropped.
  • TableName [in] the name of the table to be dropped.

Note the different syntax from SQL: A SQL Drop Table operation deletes the files from disk, while this function does not. If you wish to delete the files as well, use the ctdbDeleteTable() function. Use ctdbAddTable() to add a table to a database.


ctdbDropTable() returns CTDBRET_OK on success, or the c-tree error code on failure.


eRet = ctdbConnect(hDatabase, database_name);

eRet = ctdbDropTable(hDatabase, table_name);

See also

ctdbDeleteTable(), ctdbAddTable(), ctdbAllocDatabase()