Previous Topic

Next Topic

CTTable::Attach

Attaches a c-tree Plus ISAM datno object to a c-treeDB table object.

Declaration

void CTTable::Attach(NINT datno);

Description

  • datno is data file number opened with one of the c-tree ISAM open functions.

CTTable::Attach() attaches a c-tree Plus ISAM datno object to a c-treeDB 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 c-treeDB features such as alter table or the record handler.

Return

void

Example


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.Attach(datno);

// read the records
if (hRecord.First())
do
{
	count++;
}
while (hRecord.Next());

// cleanup
hTable.Detach();
hSession.Logout();

See Also

CTTable::AttachXtd(), CTTable::Detach()