Product Documentation

FairCom ISAM for C

Previous Topic

Next Topic

Huge File Creation Example

This example demonstrates creation of ISAM files supporting 8-byte file addresses. For simplicity, it uses a single data file with a single index with a single segment.

/* define extended file attributes */

XCREblk creblks[2] = {

{ ctFILEPOS8, /* x8mode: support HUGE data file */

0, 0, 0, 0,

1048576}, /* lxtsiz: 1MB file extensions */

{ ctFILEPOS8, /* x8mode: support HUGE index file */

0, 0, 0, 0,

1048576} /* lxtsiz: 1MB file extensions */

};


/* define ISAM attributes */

ISEG seg = { 4, 6, 0};


IIDX idx = { 14, 4, 1, 0, 0, 1, &seg};

/* Note that the segment is 6 bytes, but the key allows

* duplicates, so the key length is 14, allowing 8 bytes

* for the offset tiebreaker.

*/


IFIL fil = { "bigdata", -1, 128, 0,

ctSHARED | ctVLENGTH | ctTRNLOG, 1, 0,

ctSHARED | ctVIRTUAL | ctTRNLOG, &idx};

InitISAM(10,5,32); /* Initialize c-tree */


/* create HUGE ISAM files */

CreateIFileXtd8( &fil, NULL, NULL, 0L, NULL, NULL,

creblks /* pointer to array of XCREblks */

);


CloseIFile(&fil);

OpenIFileXtd(&fil,NULL,NULL,NULL);

CloseISAM();


/* Note the use of standard c-tree API functions after the

* initial creation of the file. The file type is invisible to

* the application unless low level calls are used or an

* explicit reference is made to a file offset.

*/

TOCIndex