isc_detach_database()

From InterBase

Go Up to API Function Reference


Detaches from a database previously connected with isc_attach_database().

Syntax

 ISC_STATUS isc_detach_database(
 ISC_STATUS *status_vector,
 isc_db_handle *db_handle);
Parameter Type Description

status_vector

ISC_STATUS *

Pointer to the error status vector

db_handle

isc_db_handle *

Pointer to a database handle set by a previous call to ­isc_attach_database().

db_handle returns an error in status_vector if it is NULL.

Description

isc_detach_database() detaches an attached database. Call this function to release system resources when you are done using a database or before re-attaching the database with different attach parameters. isc_detach_database() also releases the buffers and structures that control the remote interface on the client and the remote server where the database is stored.

Before calling isc_detach_database() commit or roll back transactions affecting the database from which you want to detach.

Example

The following conditional statement detaches a database:

if (handle)
isc_detach_database(status_vector, &handle);

Assuming that handle is valid and identifies an attached database, the specified database is detached when this statement executes.

Return value

isc_detach_database() returns the second element of the status vector. Zero indicates success. A nonzero value indicates an error. For InterBase errors, the first element of the status vector is set to 1, and the second element is set to an InterBase error code.

To check for an InterBase error, examine the first two elements of the status vector directly. For more information about examining the status vector, see Handling Error Conditions.

See Also

Advance To: