ctdbSetIndexFilename
Specify the Physical index file name.
Declaration
CTDBRET ctdbSetIndexFilename(CTHANDLE Handle, pTEXT path, pTEXT filename);
Description
An application can change the current index file extension by calling ctdbSetIndexExtension().
Return
Value |
Symbolic Constant |
Explanation |
---|---|---|
0 |
CTDBRET_OK |
ctdbSetIndexFilename() returns CTDBRET_OK on success or FairCom DB API SDK error code on failure. |
See Appendix A "c-tree Plus Error Codes" in c-tree Plus Programmer's Reference Guide for a complete listing of valid c-tree Plus error values.
Example
CTHANDLE hTable = ctdbAllocTable(hDatabase);
CTHANDLE hIndex;
ctdbAddField(hTable, "name", CT_FSTRING, 20);
ctdbAddField(hTable, "age", CT_INT2);
hIndex = ctdbAddIndex(hTable, "index1", CTINDEX_FIXED, NO, NO);
ctdbSetIndexFilename(hIndex, NULL, "myindex1");
ctdbAddSegmentByName(hTable, 0, "name", CTSEG_SCHSEG);
ctdbAddIndex(hTable, "index2", CTINDEX_FIXED, NO, NO);
ctdbAddSegmentByName(hTable, 1, "age", CTSEG_SCHSEG);
hIndex = ctdbAddIndex(hTable, "index3", CTINDEX_FIXED, NO, NO);
ctdbSetIndexFilename(hIndex, NULL, "myindex2");
ctdbAddSegmentByName(hTable, 2, "name", CTSEG_SCHSEG);
ctdbAddSegmentByName(hTable, 2, "age", CTSEG_SCHSEG);
if (ctdbCreateTable(hTable, "mytable", CTCREATE_NORMAL) != CTDBRET_OK)
printf("ctdbCreateTable failed with code %d\n", ctdbGetError(hTable));
See also
ctdbGetIndexFilename(), ctdbSetIndexExtension(), ctdbAddIndex(), ctdbGetIndex()