Product Documentation

c-treeDB API API for C

Previous Topic

Next Topic

ctdbFirstRecord

Get the first record of a table

Declaration

CTDBRET ctdbFirstRecord(CTHANDLE Handle)

Description

ctdbFirstRecord() retrieves the first record of a table and copies the record data from disk into the specified record handle’s record buffer, and sets the current record to that first record. The ordering of the records is done through one of the indexes that was defined during the table creation. To define which index is sorting the table, use ctdbSetDefaultIndex(). Initially, the default index is the first defined index during the table creation.

  • Handle [in] the record handle.

If sets are enabled by ctdbRecordSetOn(), ctdbFirstRecord() will retrieve the first record in the set. Use ctdbNextRecord() to retrieve the next record on a table, ctdbPrevRecord() to retrieve the previous record on a table, and ctdbLastRecord() to retrieve the last 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.

Returns

ctdbFirstRecord() returns CTDBRET_OK on success, or INOT_ERR (101) if the table contains no records, or a c-treeDB API error on failure.

See also

ctdbAllocRecord(), ctdbNextRecord(), ctdbPrevRecord(), ctdbLastRecord(), ctdbFindRecord(), ctdbRecordSetOn(), ctdbSetDefaultIndex()

TOCIndex