Programming Interfaces Guide
CHAPTER 3. The Database Tools Interface
This section describes the functions available in the DBTools library. The functions are listed alphabetically.
Database backup function. This function is used by the DBBACKUP command-line utility.
short DBBackup ( const backup_db * );
Parameter |
Description |
---|---|
backup_db |
Pointer to a_backup_db structure |
A return code, as listed in Software component Return codes.
The DBBackup function manages all database backup tasks. For descriptions of these tasks, see The Backup utility.
Changes the name of the transaction log file. This function is used by the dblog command-line utility.
short DBChangeLogName ( const change_log * );
Parameter |
Description |
---|---|
change_log |
Pointer to a_change_log structure |
A return code, as listed in Software component Return codes.
The -t option of the dblog command line utility changes the name of the transaction log. DBChangeLogName provides a programmatic interface to this function.
For descriptions of the dblog utility, see The Transaction Log utility.
Changes a write file to refer to another database file. This function is used by the dbwrite command-line utility when the -d option is applied.
short DBChangeWriteFile ( const writefile * );
Parameter |
Description |
---|---|
writefile |
Pointer to a_writefile structure |
A return code, as listed in Software component Return codes.
For information about the Write File utility and its features, see The Write File utility.
Extracts a collation sequence from a database.
short DBCollate ( const db_collation * );
Parameter |
Description |
---|---|
db_collation |
Pointer to a_db_collation structure |
A return code, as listed in Software component Return codes.
For information about the collation utility and its features, see The Collation utility
Compresses a database file. This function is used by the dbshrink command-line utility.
short DBCompress ( const compress_db * );
Parameter |
Description |
---|---|
compress_db |
Pointer to a_compress_db structure |
A return code, as listed in Software component Return codes.
For information about the Compression utility and its features, see The Compression utility.
Creates a database. This function is used by the dbinit command-line utility.
short DBCreate ( const create_db * );
Parameter |
Description |
---|---|
create_db |
Pointer to a_create_db structure |
A return code, as listed in Software component Return codes.
For information about the initialization utility, see The Initialization utility.
Creates a write file. This function is used by the dbwrite command-line utility when the -c option is applied.
short DBCreateWriteFile ( const writefile * );
Parameter |
Description |
---|---|
writefile |
Pointer to a_writefile structure |
A return code, as listed in Software component Return codes.
For information about the Write File utility and its features, see The Write File utility.
Erases a database file and/or transaction log file. This function is used by the dberase command-line utility.
short DBErase ( const erase_db * );
Parameter |
Description |
---|---|
erase_db |
Pointer to an_erase_db structure |
A return code, as listed in Software component Return codes.
For information about the Erase utility and its features, see The Erase utility.
Uncompresses a database file. This function is used by the dbexpand command-line utility.
short DBExpand ( const expand_db * );
Parameter |
Description |
---|---|
&an_expand_db |
Pointer to an_expand_db structure |
A return code, as listed in Software component Return codes.
For information about the Uncompression utility and its features, see The Uncompression utility.
Returns information about a database file. This function is used by the dbinfo command-line utility.
short DBInfo ( const db_info * );
Parameter |
Description |
---|---|
db_info |
Pointer to a_db_info structure |
A return code, as listed in Software component Return codes.
For information about the Information utility and its features, see The Information utility.
Returns information about a database file. This function is used by the dbinfo command-line utility when the -u option is used.
short DBInfoDump ( const db_info * );
Parameter |
Description |
---|---|
db_info |
Pointer to a_db_info structure |
A return code, as listed in Software component Return codes.
For information about the Information utility and its features, see The Information utility.
Called to free resources after the DBInfoDump function is called.
short DBInfoFree ( const db_info * );
Parameter |
Description |
---|---|
db_info |
Pointer to a_db_info structure |
A return code, as listed in Software component Return codes.
For information about the Information utility and its features, see The Information utility.
Gets the status of a write file. This function is used by the dbwrite command-line utility when the -s option is applied.
short DBStatusWriteFile ( const writefile * );
Parameter |
Description |
---|---|
writefile |
Pointer to a_writefile structure |
A return code, as listed in Software component Return codes.
For information about the Write File utility and its features, see The Write File utility.
Decrements the counter and frees resources when an application is finished with the DBTools library.
short DBToolsFini ( const dbtools_info * );
Parameter |
Description |
---|---|
dbtools_info |
Pointer to a_dbtools_info structure |
A return code, as listed in Software component Return codes.
The DBToolsFini function must be called at the end of any application that uses the DBTools interface. Failure to do so can lead to lost memory resources.
Prepares the DBTools library for use.
short DBToolsInit t( const dbtools_info * );
Parameter |
Description |
---|---|
dbtools_info |
Pointer to a_dbtools_info structure |
A return code, as listed in Software component Return codes.
The primary purpose of the DBToolsInit function is to load the Adaptive Server Anywhere language DLL. The language DLL contains localized versions of error messages and prompts that DBTools uses internally.
The DBToolsInit function must be called at the start of any application that uses the DBTools interface, before any other DBTools functions.
The following code sample illustrates how to initialize and clean up DBTools:
a_dbtools_info info; short ret; memset( &info, 0, sizeof( a_dbtools_info) ); info.errorrtn = (MSG_CALLBACK)MakeProcInstance( (FARPROC)MyErrorRtn, hInst ); // initialize DBTools ret = DBToolsInit( &info ); if( ret != EXIT_OKAY ) { // DLL initialization failed ... } // call some DBTools routines . . . ... // cleanup the DBTools dll DBToolsFini( &info );
Returns the version number of the DBTools library.
short DBToolsVersion ( void );
A short integer indicating the version number of the DBTools library.
Use the DBToolsVersion function to check that the DBTools library is not older than one against which your application is developed. While applications can run against newer versions of DBTools, they cannot run against older versions.
Version numbers and compatibility
Translates a transaction log file to SQL. This function is used by the dbtran command-line utility.
short DBTranslateLog ( const translate_log * );
Parameter |
Description |
---|---|
translate_log |
Pointer to a_translate_log structure |
A return code, as listed in Software component Return codes.
For information about the log translation utility, see The Log Translation utility.
Truncates a transaction log file. This function is used by the dbbackup command-line utility.
short DBTruncateLog ( const truncate_log * );
Parameter |
Description |
---|---|
truncate_log |
Pointer to a_truncate_log structure |
A return code, as listed in Software component Return codes.
For information about the backup utility, see The Backup utility
Unloads a database. This function is used by the dbunload command-line utility and also by the dbxtract utility for SQL Remote.
short DBUnload ( const unload_db * );
Parameter |
Description |
---|---|
an_unload_db |
Pointer to an_unload_db structure |
A return code, as listed in Software component Return codes.
For information about the Unload utility, see The Unload utility.
Upgrades a database file. This function is used by the dbupgrade command-line utility.
short DBUpgrade ( const upgrade_db * );
Parameter |
Description |
---|---|
upgrade_db |
Pointer to an_upgrade_db structure |
A return code, as listed in Software component Return codes.
For information about the upgrade utility, see The Upgrade utility.
Validates all or part of a database. This function is used by the dbvalid command-line utility.
short DBValidate ( const validate_db * );
Parameter |
Description |
---|---|
validate_db |
Pointer to a_validate_db structure |
A return code, as listed in Software component Return codes.
For information about the upgrade utility, see The Validation utility.