Product Documentation

FairCom DB API for C

Previous Topic

Next Topic

ctdbDeleteRecord

Delete an existing record.

Declaration

CTDBRET ctdbDeleteRecord(CTHANDLE Handle)

Description

ctdbDeleteRecord() deletes an existing record from a table. While not enforced by the FairCom DB API API, it is strongly recommended that a WRITE_LOCK be acquired on the record before it is deleted by calling this function. To lock the record, use either session-wide record locking (ctdbLock()) or manually lock the record by calling ctdbdbLockRecord().

Once a record has been deleted, FairCom DB API automatically releases any locks that were held by that record. Outside of a transaction, the locks are released before the ctdbDeleteRecord() function returns. Inside a transaction, the locks are held until the transaction is ended (the ctdbCommit() or the ctdbAbort() function returns).

Note that if the table was opened in CTOPEN_CHECKLOCK or CTOPEN_CHECKREAD mode (see ctdbOpenTable()), then the corresponding locks must be obtained before the record is read / deleted.

  • Handle [in] the record handle.

Returns

ctdbDeleteRecord() returns CTDBRET_OK if successful, or the c-tree error code on failure.

See also

ctdbAllocRecord(), ctdbLock(), ctdbdbLockRecord(), ctdbReadRecord(), ctdbWriteRecord()

TOCIndex