
April 17th, 2005, 03:22 AM
|
|
Registered User
|
|
Join Date: Apr 2005
Posts: 6
Time spent in forums: 1 h 57 sec
Reputation Power: 0
|
|
|
Database creating in Interbase/Firebird
Here is the source:
Code:
bool CreateDatabase(const char *db_name)
{
// Constructing database creation query
unsigned short query_length = 19;
query_length += strlen(db_name);
char *create_db_query = new char[query_length];
strcpy(create_db_query, "CREATE DATABASE '");
strcat(create_db_query, db_name);
strcat(create_db_query, "'\0");
// Creating the specified database
ISC_STATUS_ARRAY sts;
isc_tr_handle tr = NULL;
isc_db_handle db_handle = NULL;
isc_start_transaction(sts, &tr, 1, &db_handle, 0, NULL);
if(isc_dsql_execute_immediate(sts, &db_handle, &tr, 0, create_db_query, 1, NULL))
return false;
isc_commit_transaction(sts, &tr);
return true;
}
After calling the function false value is returned. Where is the error?
|