ctdbDetachTable
Detaches a c-treeDB API table handle from a c-tree data and index files.
DECLARATION
CTDBRET ctdbDetachTable(CTHANDLE Handle);
DESCRIPTION
ctdbDetachTable() detaches a c-treeDB API table handle from a c-tree data and index files. The table is not closed but the c-treeDB API table handle resources are released and the handle re-initialized. Handle is a c-treeDB API table handle allocated by ctdbAllocTable().
RETURN
Value |
Symbolic Constant |
Explanation |
---|---|---|
0 |
NO_ERROR |
No error occurred. |
See Appendix A for a complete listing of valid c-tree Plus error values.
EXAMPLE
CTHANDLE hSession = ctdbAllocSession(CTSESSION_CTREE);
CTHANDLE hTable = ctdbAllocTable(hSession);
CTHANDLE hRecord = ctdbAllocRecord(hTable);
NINT datno, count = 0;
/* logon to c-tree */
ctdbLogon(hSession, SERVER, USER, PASSWD);
/* open the file using c-tree ISAM */
datno = (NINT)OPNRFILX((COUNT) -1, "test309.dat", (COUNT)0, NULL);)
/* attach to table */
ctdbAttachTable(hTable, datno);
/* read the records */
if (ctdbFirstRecord(hRecord) == CTDBRET_OK)
do
{
count++;
}
while (ctdbNextRecord(hRecord) == CTDBRET_OK);
/* cleanup */
ctdbDetachtable(hTable);
ctdbFreeRecord(hRecord);
ctdbFreeTable(hTable);
ctdbLogout(hSession);
ctdbFreeSession(hSession);
SEE ALSO
ctdbAttachTable(), ctdbAttachTableXtd()