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 ( constbackup_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( constchange_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( constwritefile*);
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( constdb_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( constcompress_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( constcreate_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( constwritefile*);
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( consterase_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( constexpand_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( constdb_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( constdb_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( constdb_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( constwritefile*);
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 after DBTools library is finished with.
short DBToolsFini ( constdbtools_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( constdbtools_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 SQL Anywhere language DLL. The language DLL contains localized versions of all the 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.
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 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.
Translates a transaction log file to SQL. This function is used by the DBTRAN command-line utility.
short DBTranslateLog( consttranslate_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( consttruncate_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.
short DBUnload( constunload_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( constvalidate_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".