F.37 CreateIndexMember
Create an additional index file member.
Short Name
CREMEM
TYPE
Low level index file function
DECLARATION
COUNT CreateIndexMember(COUNT keyno, COUNT keylen,COUNT keytyp, COUNT keydup, COUNT membno)DESCRIPTION
CreateIndexMember attempts to add an additional index to index file number keyno, just created by CreateIndexFile. This additional index file member has a key length of keylen bytes.
keytyp determines whether keys are fixed length or use some form of compression. See Section 3.2.1 "Alternative Key Types" on page 3-4 in the c-tree Plus Programmer's Reference Guide for more information.
keydup of 0 indicates no duplicates allowed, and a value of 1 indicates duplicate keys are supported.
membno must be in the range from 1 to the number of members set by the previous call to CreateIndexFile (see the nomemb parameter of CreateIndexFile). Subsequent calls to other low-level index file functions use keyno + membno to reference this file. For example, if keyno is three (3) and membno is two (2), then this additional index file member is referenced as file number five (5).
RETURN
See Appendix A "c-tree Plus Error Codes" of the c-tree Plus Programmer's Reference Guide for a complete listing of valid c-tree Plus error values.
EXAMPLE
COUNT keyno = 0, retval, keylen,keytyp,keydup,nomemb;UCOUNT xtdsiz = 1024;TEXT filnam[15] = "sample.dat";if (retval = InitCtree(6,7,4))printf("\nCould not initialize. Error %d.", retval);else {if (CreateIndexFile(keyno, filnam, keylen, keytyp,keydup, nomemb, 8192, (ctSHARED | ctVIRTUAL)))printf("\nError %d creating file %.14s",uerr_cod,filnam);else {if (CreateIndexMember(keyno, keylen2, keytyp2,keydup2, membno);printf("Error %d adding member %d.", uerr_cod,membno);if (CloseCtFile(keyno, 0))printf("\nCould not close file.");if (OpenCtFile(keyno, filnam,(ctSHARED | ctVIRTUAL | ctFIXED)))printf("\nCould not open file.");else if (CloseCtFile(keyno, 0))printf("\nCould not close file.");}if (CloseISAM())printf("\nCould not close ISAM.");}LIMITATIONS
See the Limitations discussion under CreateIndexFile.
SEE ALSO
SetAlternateSequence, InitCTree, CreateIndexFile, OpenCtFile and Section 3.2 "c-tree Plus Keys" on page 3-4 of the c-tree Plus Programmer's Reference Guide for a discussion on how automatic support of duplicate keys is handled.
|
FairCom Corporation www.faircom.com |