Product Documentation

c-treeDB API API for C

Previous Topic

Next Topic


Get the last record on a table.


CTDBRET ctdbLastRecord(CTHANDLE Handle)


ctdbLastRecord() retrieves the last record on a table and copies the record data from disk into the specified record handle’s record buffer, and sets the current record to that last record.

  • Handle [in] the record handle.

If sets are enabled by ctdbRecordSetOn(), ctdbLastRecord() will retrieve the last record in the set. Use ctdbFirstRecord() to retrieve the first record on a table, ctdbNextRecord() to retrieve the next record on a table, and ctdbPrevRecord() to retrieve the previous record on a table. Use ctdbFindRecord() to find a specific record on a table. Note that if session-wide record locking is enabled, this function will also lock the record it retrieves.


ctdbLastRecord() returns CTDBRET_OK on success, or INOT_ERR (101) if the table is empty, or a c-treeDB API error on failure.

See also

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