odbx_unbind(3)

NAME
odbx_unbind - Disconnects from the database

SYNOPSIS
\FC#include <opendbx/api.h>\F[]

\FCint odbx_unbind\F[]
\FC(odbx_t* handle);\F[]

DESCRIPTION
Releases the binding of the connection to the database and user associated by \FCodbx_bind\F[]() to the supplied connection object. This is useful for switching to a different database or binding to the database with different credentials. It is also possible to set new connection related options before rebinding to the database server. If an open transaction exists while this function is executed in the firebird backend, it will be committed to the database and closed. The behavior of the other backends for open transactions may vary.

It's necessary to process all result sets returned by the database server before using this function. Otherwise, it might return an error depending on the native database client library and the backend module. This function must be invoked before calling \FCodbx_finish\F[]() to avoid memory leaks and connections left open which may block necessary resources later on.

The \FChandle\F[] parameter has to be the connection object created and returned by \FCodbx_init\F[](). It becomes invalid after it was supplied to \FCodbx_finish\F[]() and \FCodbx_unbind\F[]() will return an error in this case.

RETURN VALUE
\FCodbx_unbind\F[]() returns \FCODBX_ERR_SUCCESS\F[], or an error code whose value is less than zero if one of the operations couldn't be completed successfully. Possible error codes are listed in the error section and they can be feed to \FCodbx_error\F[]() and \FCodbx_error_type\F[]() to get further details.

ERRORS

-\FCODBX_ERR_PARAM\F[]
    \FChandle\F[] is NULL or the supplied connection object is invalid

SEE ALSO
\FCodbx_bind\F[](), \FCodbx_error\F[](), \FCodbx_finish\F[]()