CTTable::AttachXtd
Attaches a c-tree Plus ISAM datno object to a FairCom DB API table handle allowing a DODA and IFIL to be specified.
Declaration
void CTTable::AttachXtd(NINT datno, NINT nbrfields, pDATOBJ dodaptr,
pIFIL ifilptr);
Description
CTTable::AttachXtd() attaches a c-tree Plus ISAM datno object to a FairCom DB API table object. This function is useful if you have opened a data and index file using one of c-tree’s ISAM open functions and need to attach it to a table handle to use some of the advanced FairCom DB API features such as alter table or the record handler. This extended version allows the user to specify the DODA and IFIL for the table, enabling tables without DODA and/or IFIL to be attached to FairCom DB API.
Return
void
Example
/* DODA */
static DATOBJ doda[] =
{
{"f1", (pTEXT)0, CT_INT4, 4},
{"f2", (pTEXT)4, CT_FSTRING, 10}
};
/* IFIL */
static ISEG iseg = {0, 4, 12};
static IIDX iidx = {4, 0, 0, 0, 0, 1, &iseg, "i311x1", NULL, NULL, NULL};
static IFIL ifil = {"test310", -1, 14, 0, 0, 1, 0, 0, &iidx, "f1", "f2", 0};
CTSession hSession(CTSESSION_CTREE);
CTTable hTable(hSession);
CTRecord hRecord(hTable);
NINT datno, count = 0;
// logon to c-tree
hSession.Logon(SERVER, USER, PASSWD);
// open the file using c-tree ISAM
datno = (NINT)OPNRFILX((COUNT) -1, "test309.dat", (COUNT)0, NULL);)
// attach to table
hTable.AttachXtd(datno, 2, doda, &ifil);
// read the records
if (hRecord.First())
do
{
count++;
}
while (hRecord.Next());
// cleanup
hTable.Detach();
hSession.Logout();