Done
When an application and/or process has completed operations with the database, it must release resources by disconnecting from the database engine. Below is the code for Done(): /* * Done() * * This function handles the housekeeping of closing tables and * freeing of associated memory */ #ifdef PROTOTYPE VOID Done(VOID) #else VOID Done() #endif {
printf("DONE\n");
/* close tables */ printf("\tClose tables...\n");
if (ctdbCloseTable(hTableCustMast)) Handle_Error("Done(): ctdbCloseTable()");
if (ctdbCloseTable(hTableOrdrItem)) Handle_Error("Done(): ctdbCloseTable()");
if (ctdbCloseTable(hTableCustOrdr)) Handle_Error("Done(): ctdbCloseTable()");
if (ctdbCloseTable(hTableItemMast)) Handle_Error("Done(): ctdbCloseTable()");
/* logout */ printf("\tLogout...\n");
if (ctdbLogout(hSession)) Handle_Error("Done(): ctdbLogout()");
/* free handles */ ctdbFreeRecord(hRecordCustMast); ctdbFreeRecord(hRecordItemMast); ctdbFreeRecord(hRecordOrdrItem); ctdbFreeRecord(hRecordCustOrdr); ctdbFreeTable(hTableCustMast); ctdbFreeTable(hTableItemMast); ctdbFreeTable(hTableOrdrItem); ctdbFreeTable(hTableCustOrdr); ctdbFreeSession(hSession); } |
|||