Declaring Database Handles

From InterBase
Jump to: navigation, search

To establish database handles for use, declare a variable of type isc_db_handle for each database that will be accessed at the same time. The following code declares two handles:

#include <ibase.h>
. . .
isc_db_handle db1;
isc_db_handle db2;

Once a database is no longer attached, its handle can be assigned to a different database in a subsequent attachment. If an application accesses several databases, but only accesses a subset of databases at the same time, it is only necessary to declare as many handles as there will be simultaneous database accesses. For example, if an application accesses a total of three databases, but only attaches to two of them at a time, only two database handles need be declared.