Contents Index Using the import libraries Calling the DBTools functions

ASA Programming Guide
  The Database Tools Interface
    Using the database tools interface

Starting and finishing the DBTools library


Before using any other DBTools functions, you must call DBToolsInit. When you are finished using the DBTools DLL, you must call DBToolsFini.

The primary purpose of the DBToolsInit and DBToolsFini functions is to allow the DBTools DLL to load the Adaptive Server Anywhere language DLL. The language DLL contains localized versions of all error messages and prompts that DBTools uses internally. If DBToolsFini is not called, the reference count of the language DLL is not decremented and it will not be unloaded, so be careful to ensure there is a matched pair of DBToolsInit/DBToolsFini calls.

The following code fragment illustrates how to initialize and clean up DBTools:

// Declarations
a_dbtools_info   info;
short            ret;

//Initialize the a_dbtools_info structure
memset( &info, 0, sizeof( a_dbtools_info) );
info.errorrtn = (MSG_CALLBACK)MyErrorRtn;

// initialize DBTools
ret = DBToolsInit( &info );
if( ret != EXIT_OKAY ) {
   // DLL initialization failed
   ...
}
// call some DBTools routines . . .
...
// cleanup the DBTools dll
DBToolsFini( &info );

Contents Index Using the import libraries Calling the DBTools functions