Macro WITH-DATABASE — Execute a body of code with a variable bound to a specified database object.
Macro
with-database db-var connection-spec &rest connect-args &body body => result
A variable to which the specified database is bound.
A vendor specific connection specification supplied as a list or as a string.
Other optional arguments to connect.
A Lisp code body.
Determined by the result of executing the last expression in body.
Evaluate body in an environment, where db-var is bound to the database connection given by connection-spec and connect-args. The connection is automatically closed or released to the pool on exit from the body.
(connected-databases) => NIL (with-database (db '(":memory:") :database-type :sqlite :make-default nil) (database-name db)) => ":memory:" (connected-databases) => NIL
See connect and disconnect.
See connect and disconnect.
See connect and disconnect.
with-database is a CLSQL extension.