Product Documentation

c-treeDB API API for C

Previous Topic

Next Topic

ctdbMoveSegment

Moves a key segment to a location indicated by newIndex.

DECLARATION

CTDBRET ctdbDECL ctdbMoveSegment(CTHANDLE Handle, NINT newIndex);

DESCRIPTION

ctdbMoveSegment() moves a key segment to a location indicated by newIndex. Handle is a segment handle and newIndex indicates the relative position were the key segment should be moved to.

RETURN

Value

Symbolic Constant

Explanation

0

CTDBRET_OK

No error occurred.

See Appendix A for a complete listing of valid c-tree Plus error values.

EXAMPLE

/* move the last segment to first */

NINT count = ctdbGetIndexSegmentCount(hIndex);

if (count > 0)

{

CTHANDLE hSeg = ctdbGetSegment(hIndex, (count - 1));

if (ctdbMoveSegment(hSeg, 0) != CTDBRET_OK)

printf("ctdbMoveSegment failed\n");

}

SEE ALSO

ctdbAddSegment(), ctdbInsSegment(), ctdbDelSegment()

TOCIndex