diff options
author | scgilardi <scgilardi@gmail.com> | 2009-01-21 03:09:09 +0000 |
---|---|---|
committer | scgilardi <scgilardi@gmail.com> | 2009-01-21 03:09:09 +0000 |
commit | a896cc837716e11cb7c8fd3d24a5217efc05ff52 (patch) | |
tree | e65a8ee06e93f3d697f00f2cfdaece4f32d1c9ef /src/clojure/contrib/sql.clj | |
parent | 4c00ce62f9fdb72a9b9fd6c0e0336b7ccc2074cd (diff) |
sql: add :datasource as a way to specify a database to with-connection
Diffstat (limited to 'src/clojure/contrib/sql.clj')
-rw-r--r-- | src/clojure/contrib/sql.clj | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/clojure/contrib/sql.clj b/src/clojure/contrib/sql.clj index 75242b5c..ca9e1c71 100644 --- a/src/clojure/contrib/sql.clj +++ b/src/clojure/contrib/sql.clj @@ -24,13 +24,19 @@ (defmacro with-connection "Evaluates body in the context of a new connection to a database then - closes the connection. db-spec is a map containing string values for - these required keys: - :classname the jdbc driver class name - :subprotocol the jdbc subprotocol - :subname the jdbc subname - If db-spec contains additional keys (such as :user, :password, etc.) and - associated values, they will be passed along to the driver as properties." + closes the connection. db-spec is a map containing values for one of the + following parameter sets: + + DataSource: + :datasource (required) a javax.sql.DataSource + :username (optional) a String + :password (optional) a String + + DriverManager: + :classname (required) a String, the jdbc driver class name + :subprotocol (required) a String, the jdbc subprotocol + :subname (required) a String, the jdbc subname + (others) (optional) passed to the driver as properties." [db-spec & body] `(with-connection* ~db-spec (fn [] ~@body))) |