Product Documentation

FairCom DB API for C

Previous Topic

Next Topic

ctdbClearRecord

Clear the record buffer.

Declaration

CTDBRET ctdbClearRecord(CTHANDLE Handle)

Description

ctdbClearRecord() clears the record buffer that is part of the record handle. Before clearing a record, the record handle should be active (associated with a table). After the call to ctdbClearRecord(), functions that depend on the "current record" (like ctdbNextRecord() and ctdbPrevRecord()) will return an error (CTDBRET_NOTACTIVE), because the specified record handle is no longer associated with a particular record in the table. This function also resets the padding, zeroes out all of the number fields, and sets all of the bits of the NULL flag, meaning "all of the fields in this record handle are NULL (not set to anything yet)."

Note that this function does NOT break the record handle’s association with its table. After calling this function, the record handle is still associated with the table that was specified when the handle was allocated by calling ctdbAllocRecord().

It is very important to clear the record buffer BEFORE using this record handle to add a new record to a table. If the user tries to add a new record, and the buffer is not cleared by calling this function first, the new record will replace (rewrite) the active record (whatever record the specified record handle is currently associated with), or return an error ICUR_ERR (100) in the event the record handle has been instantiated, but not cleared.

  • Handle [in] the record handle.

Returns

ctdbClearRecord() returns CTDBRET_OK on success, or FairCom DB API error code on failure.

See also

ctdbAllocRecord(), ctdbResetRecord()

TOCIndex