diff options
author | scgilardi <scgilardi@gmail.com> | 2009-04-09 19:19:04 +0000 |
---|---|---|
committer | scgilardi <scgilardi@gmail.com> | 2009-04-09 19:19:04 +0000 |
commit | 45bd387c1e3ddf431a5c7123b5bc4279125b4751 (patch) | |
tree | 49820f4623f12cf2048193a97fadfbb4d66accd0 /src/clojure/contrib/sql | |
parent | 9ea45de2be0334513ff4230dcd842a06936bd7ad (diff) |
sql.internal: use java-utils/as-properties
Diffstat (limited to 'src/clojure/contrib/sql')
-rw-r--r-- | src/clojure/contrib/sql/internal.clj | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/src/clojure/contrib/sql/internal.clj b/src/clojure/contrib/sql/internal.clj index af455fa2..5929d926 100644 --- a/src/clojure/contrib/sql/internal.clj +++ b/src/clojure/contrib/sql/internal.clj @@ -14,21 +14,10 @@ (ns clojure.contrib.sql.internal (:use (clojure.contrib [except :only (throw-arg)] - [java-utils :only (as-str)]))) + [java-utils :only (as-properties)]))) (def *db* {:connection nil :level 0}) -; TODO: test and move to clojure.contrib.java-utils? -(defn properties - "Converts a map from keywords, symbols, or strings to values into a - java.util.Properties object that maps the key names to the values with - all represented as strings." - [m] - (let [p (java.util.Properties.)] - (doseq [[key val] (seq m)] - (.setProperty p (as-str key) (as-str val))) - p)) - (defn find-connection* "Returns the current database connection (or nil if there is none)" [] @@ -71,7 +60,7 @@ (.getConnection datasource)) (java.sql.DriverManager/getConnection (format "jdbc:%s:%s" subprotocol subname) - (properties (dissoc db-spec :classname :subprotocol :subname))))) + (as-properties (dissoc db-spec :classname :subprotocol :subname))))) (defn with-connection* "Evaluates func in the context of a new connection to a database then |