diff options
Diffstat (limited to 'src/clojure_sql/core.clj')
-rw-r--r-- | src/clojure_sql/core.clj | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/clojure_sql/core.clj b/src/clojure_sql/core.clj index f10d968..e77eeb0 100644 --- a/src/clojure_sql/core.clj +++ b/src/clojure_sql/core.clj @@ -58,11 +58,19 @@ (q/set-query-deref-behaviour! run-query) -(let [users (-> (table :users) - (project [:id :username :password-hash]))] - (insert! (-> users - (project [:username])) - {:username "john"} - {:username "not-john"} - {:username "bleep bloop"})) + + +(try + (require '[clojure.java.jdbc :as jdbc]) + (defn use-jdbc! [connection-string] + (set-query-executor! (fn [type query] + (jdbc/with-connection connection-string + (case type + :query (jdbc/with-query-results results query + (vec results)) + :insert (jdbc/do-prepared-return-keys (first query) (next query)) + (jdbc/do-prepared (first query) (next query))))))) + + (catch Exception e + )) |