Product Documentation

c-treeDB API API for C

Previous Topic

Next Topic

ctdbGetSegmentPartialField

Retrieves the field handle on which a key segment is based, even if the segment does not match the entire field length.

DECLARATION

CTHANDLE ctdbDECL ctdbGetSegmentPartialField(CTHANDLE Handle);

DESCRIPTION

c-treeDB API was able to find the matching between a key segment and a field only if the key segment started at the beginning of a field and exactly matched the field length, as it is required by FairCom DB SQL. It was desirable to retrieve a field on which the key segment start at the beginning of a field but does not exactly match the entire field.

CtdbGetSegmentPartialField() was added to c-treeDB API C API to retrieve the field handle on which a key segment is based, even if the segment does not match the entire field length.

  • Handle is the segment handle that we are trying to match to one of the table fields.

ctdbGetSegmentPartialField() returns the handle of the field that matches the key segment definition. If a match can’t be found, or if an error is detected, this function returns NULL.

RETURN

Returns the field handle that matches the segment or NULL if no such match exists.

EXAMPLE

/* try to find a match, or partial match, for the key segment */

CTHANDLE GetFieldMatch(CTHANDLE hIndex, NINT segnbr)

{

CTHANDLE hField = NULL;

CTHANDLE hSegment = ctdbGetSegment(hIndex, segnbr);

if (hSegment)

hField = ctdbGetSegmentPartialField(hSegment);

return hField;

}

SEE ALSO

ctdbGetSegmentField(), ctdbGetSegmentFieldName()

TOCIndex