Product Documentation

c-treeDB API API for C

Previous Topic

Next Topic


Get the previous record in a table.


CTDBRET ctdbPrevRecord(CTHANDLE Handle)


ctdbPrevRecord() retrieves the previous record in a table and copies the record data from disk into the specified record handle’s record buffer, and moves the current record to the previous record in that table. Note that if session-wide record locking is enabled, this function will also lock the record it retrieves.

  • Handle [in] the record handle.

If sets are enabled by ctdbRecordSetOn(), ctdbPrevRecord() will retrieve the previous record in the set. Use ctdbFirstRecord() to retrieve the first record on a table, ctdbNextRecord() to retrieve the next record on a table, and ctdbLastRecord() to retrieve the last record on a table. Use ctdbFindRecord() to find a specific record on a table. ctdbNextRecord() and ctdbPrevRecord() must be used after at least one call was done to ctdbFirstRecord(), ctdbLastRecord(), or ctdbFindRecord().


ctdbPrevRecord() returns CTDBRET_OK on success, or INOT_ERR (101) if the current record was the first record in the table, or ICUR_ERR (100) if there is no current record, or a c-treeDB API C API error on failure.

See also

ctdbAllocRecord(), ctdbFirstRecord(), ctdbNextRecord(), ctdbLastRecord(), ctdbFindRecord(), ctdbRecordSetOn()