Product Documentation

c-treeDB API API for C

Previous Topic

Next Topic

ctdbGetSegmentStatus

Retrieves the status of the segment handle.

DECLARATION

ULONG ctdbGetSegmentStatus(CTHANDLE Handle);

DESCRIPTION

Retrieves the status of a segment handle.

  • Handle is a segment handle.

The status of the segment handle is a bit map describing one or more changes that have occurred to the segment handle.

RETURN

ctdbGetSegmentStatus returns a bitmap of the following:

Value

Symbolic Constant

Explanation

0x00

CTDBISEG_OLD

Original segment as read from file

0x01

CTDBISEG_NEW

Segment added or inserted

0x02

CTDBISEG_DEL

Original segment deleted

0x04

CTDBISEG_MOVED

Original segment moved

0x10

CTDBISEG_MODE

Segment mode changed

0x20

CTDBISEG_FIELD

Segment field changed

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

EXAMPLE

/* if any segment of an index has changed, call alter table */

for (i = 0; i < (NINT) ctdbGetIndexSegmentCount(hIndex); i++)

{

CTHANDLE hSeg = ctdbGetSegment(hIndex, i);

if (ctdbGetSegmentStatus(hSeg) != CTDBISEG_OLD)

if (ctdbAlterTable(hIndex, CTDB_ALTER_NORMAL) != CTDBRET_OK)

printf("ctdbAlterTable failed\n");

}

SEE ALSO

ctdbGetFieldStatus(), ctdbGetIndexStatus()

TOCIndex