Product Documentation

c-treeDB API API for C

Previous Topic

Next Topic


Find a record using a target key.


CTDBRET ctdbFindTarget(CTHANDLE Handle, pVOID target,



ctdbFindTarget() finds a record with a given target key. The record data is retrieved from disk into the record handle’s record buffer and the current record is set to that record. Note that if session-wide record locking is enabled, this function will also lock the record it retrieves. Use ctdbFindRecord() to find a record with the FindMode() strategy.

  • Handle [in] the record handle.
  • target [in] string with the key target to lookup in the table.
  • FindMode [in] the mode to use to look for the record in the table. The find modes are listed in c-treeDB API definitions.

The target key MUST be transformed (use ctdbBuildTargetKey() if necessary).

Note: The Find Mode CTFIND_EQ requires that the target contains values for all segments that compose the index and the index cannot allow duplicates.

Note: Prior to FairCom DB V9.1, the key target in FindTarget() must NOT be transformed. When using functions such as TransformKey() or BuildTargetKey(), you must suppress the transformation of the already-transformed key. In order to do this, you may define a macro NOTRANSFORM with a value of 0x1000 and OR it into the mode passed to FindTarget().


ctdbFindTarget() returns CTDBRET_OK if the record was found, or INOT_ERR (101) if no record is found. Any other return value indicates an error condition (c-treeDB error).

See also

ctdbAllocRecord(), ctdbFindRecord()