DISCONNECT — close a database connectionFunction
error
A boolean flag indicating whether to signal an error
if database
is non-NIL
but cannot
be found.
database
The database to disconnect, which defaults to the database indicated by *default-database*.
result
A Boolean indicating whether a connection was successfully disconnected.
This function takes a database object as
returned by connect
, and closes the
connection. If no matching database is found and
error
and
database
are both non-NIL
an error is
signaled, otherwise NIL
is returned. If the database is from a
pool it will be released to this pool.
The status of the object passed is changed to closed
after the disconnection succeeds, thereby preventing further
use of the object as an argument to CLSQL functions, with
the exception of database-name
and
database-type
. If the user does pass a
closed database to any other CLSQL function, an error of
type sql-fatal-error is
signalled.
The database object is removed from the list of connected databases as
returned by connected-databases
.
If the database object passed is the same under
eq
as the value of
*default-database*, then
*default-database* is set to the first
remaining database from
connected-databases
or to NIL
if no
further active database exists.
The database connection is closed and the state of the database object is changed to closed.
Unless there are already *db-pool-max-free-connections* free connections in the pool it is returned to the pool, with the backend having an opportunity to run generic cleanup on the connection first. If the max free connections has already been reached then it is disconnected as if it were not in the pool.