From: Marc Battyani Date: Sat, 4 May 2002 09:27:12 +0000 (+0000) Subject: r1903: mod with-database again... X-Git-Tag: v3.8.6~1126 X-Git-Url: http://git.kpe.io/?a=commitdiff_plain;ds=sidebyside;h=99f35316c86a16c2b6d9c3de4a9522041a970f04;p=clsql.git r1903: mod with-database again... --- diff --git a/sql/functional.cl b/sql/functional.cl index 6362154..fdb8cb8 100644 --- a/sql/functional.cl +++ b/sql/functional.cl @@ -8,7 +8,7 @@ ;;;; ;;;; Copyright (c) 1999-2001 Pierre R. Mai ;;;; -;;;; $Id: functional.cl,v 1.4 2002/05/04 02:43:15 kevin Exp $ +;;;; $Id: functional.cl,v 1.5 2002/05/04 09:27:12 marc.battyani Exp $ ;;;; ;;;; This file is part of CLSQL. ;;;; @@ -84,18 +84,11 @@ where) :database database)))) -(defmacro with-database ((db-var connection-spec - &rest connect-args - &key (pool nil)) - &body body) +(defmacro with-database ((db-var connection-spec &rest connect-args) &body body) "Evaluate the body in an environment, where `db-var' is bound to the database connection given by `connection-spec' and `connect-args'. -If pool is t the the connection will be taken from the general pool, -if pool is a conn-pool object the connection will be taken from this pool. -The connection is automatically closed or released to the pool -on exit from the body." - `(let ((,db-var (connect ,connection-spec :pool ,pool ,@connect-args))) - (unwind-protect - (progn - ,@body) - (disconnect :database ,db-var :poool ,pool)))) +The connection is automatically closed or released to the pool on exit from the body." + `(let ((,db-var (connect ,connection-spec ,@connect-args))) + (unwind-protect + (let ((,db-var ,db-var)) ,@body) + (disconnect :database ,db-var))))