Previous Topic

Next Topic

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, freeing,
// disconnecting and logging out of the database
//

VOID Done(VOID)
{
   printf("DONE\n");

   try
   {
      // close tables
      printf("\tClose tables...\n");
      tableCustOrdr->Close();
      tableOrdrItem->Close();
      tableItemMast->Close();
      tableCustMast->Close();

      // logout from session
      printf("\tLogout...\n");
      MySession->Logout();
   }
   catch(CTException E)
   {
      Handle_Exception(E);
   }

   // release record objects
   delete recordCustMast;
   delete recordItemMast;
   delete recordOrdrItem;
   delete recordCustOrdr;

   // release table objects
   delete tableCustMast;
   delete tableItemMast;
   delete tableOrdrItem;
   delete tableCustOrdr;

   // release session object
   delete MySession;
}