|
<< Click to Display Table of Contents >> Step 11: Free all resources |
![]() ![]()
|
After all data access operations have been performed, clean up the resources that were allocated on behalf of the application. In addition to any memory explicitly allocated by the application using AllocMem, all engine objects must also be cleaned up, including the cursor, database, and engine. Use the Delphi function FreeMem to free allocated memory. Use DbiCloseCursor to close the cursor to the table. Use DbiCloseDatabase to close the database used in the application. Finally, use DbiExit to close the BDE itself.
{ Free the record buffer }
FreeMem(RecordBuffer);
{ Close the cursor }
if not (hCur = nil) then Check(DbiCloseCursor(hCur));
{ Close the database }
if not (hDB = nil) then Check(DbiCloseDatabase(hDB));
{ Close the BDE }
Check(DbiExit);