projects
/
clsql.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
dcb1ec3
)
r1895: updated with-database
author
Kevin M. Rosenberg
<kevin@rosenberg.net>
Fri, 3 May 2002 18:17:50 +0000
(18:17 +0000)
committer
Kevin M. Rosenberg
<kevin@rosenberg.net>
Fri, 3 May 2002 18:17:50 +0000
(18:17 +0000)
sql/functional.cl
patch
|
blob
|
history
diff --git
a/sql/functional.cl
b/sql/functional.cl
index d5f72ddb6e41916c2eaa7c59801e3b2273167ae0..9050b4cd81b0532b7d33e34432e4c7a808027348 100644
(file)
--- a/
sql/functional.cl
+++ b/
sql/functional.cl
@@
-8,7
+8,7
@@
;;;;
;;;; Copyright (c) 1999-2001 Pierre R. Mai
;;;;
;;;;
;;;; Copyright (c) 1999-2001 Pierre R. Mai
;;;;
-;;;; $Id: functional.cl,v 1.
1 2002/03/23 14:04:54
kevin Exp $
+;;;; $Id: functional.cl,v 1.
2 2002/05/03 18:17:50
kevin Exp $
;;;;
;;;; This file is part of CLSQL.
;;;;
;;;;
;;;; This file is part of CLSQL.
;;;;
@@
-84,11
+84,16
@@
where)
:database database))))
where)
:database database))))
-(defmacro with-database ((db-var connection-spec &rest connect-args) &body body)
+(defmacro with-database ((db-var connection-spec
+ &key (if-exists *connect-if-exists*)
+ (database-type *default-database-type*)
+ (pool nil))
+ &body body)
"Evaluate the 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 on exit from the body."
"Evaluate the 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 on exit from the body."
- `(let ((,db-var (connect ,connection-spec ,@connect-args)))
+ `(let ((,db-var (connect ,connection-spec :pool pool
+ :database-type database-type :if-exists if-exists)))
(unwind-protect
(let ((,db-var ,db-var)) ,@body)
(unwind-protect
(let ((,db-var ,db-var)) ,@body)
- (disconnect :database ,db-var))))
+ (disconnect :database ,db-var
:pool pool
))))