Product Documentation

FairCom DB API for C

Previous Topic

Next Topic

ctdbDeleteTable

Drop a table from a database and delete its data and index files from disk.

Declaration

CTDBRET ctdbDeleteTable(CTHANDLE Handle, pTEXT TableName, pTEXT Password)

Description

ctdbDeleteTable() drops the table from the database and deletes the table data and index files from disk. This function should be used with care, since it will remove from disk the data and index file(s) associated with the specified table. Note that active/open tables must be closed before they can be deleted with this function (see ctdbCloseTable()).

  • Handle [in] the handle of the database that contains the table to be deleted.
  • TableName [in] the name of the table to be deleted.
  • Password [in] the table password. NULL if the table was created w/o a password.

Use ctdbAddTable() to add a table to a database. Use ctdbDropTable() to drop the table from the database but not delete the table files from disk.

Note: ctdbDeleteTable() is for use within a CTDB or SQL session. For a CTREE session, you must use ctdbRemoveTable(). See also Allocating a Session Handle.

Returns

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

Example


eRet=ctdbConnect(hDatabase, database_name);

eRet = ctdbDeleteTable(hDatabase, table_name, NULL);

See also

ctdbAddTable(), ctdbDropTable(), ctdbAllocDatabase()

TOCIndex