[All]
Creating a database via the InterBase API.
By: Borland Staff
Abstract: Steps for Creating a Database via InterBase API
Problem:
I can't figure out how to create a database on the fly with the API.
Solution:
For more details see the documentation in the "API Guide", page 66.
Steps for Creating a Database via API
------------------------------------------------------
1) Detach from any currently attached databases via isc_detach_database()
* this sets its database handle to NULL.
2) Build the create statement to process.
3) Execute the statement via: isc_dsql_execute_immediate() or
isc_dsql_execute_immed2()
Code: Example
------------------------------
char *str = "CREATE DATABASE "new_emp.gdb"";
. . .
isc_detach_database(status_vector, &db1);
isc_dsql_execute_immediate(status_vector, &db1, &trans, 0, str, 1, NULL);
Connect with Us