From fb946311da111e2a422a938b0b8720c3ecf3341c Mon Sep 17 00:00:00 2001 From: Carlo Zancanaro Date: Fri, 21 Jun 2013 10:42:56 +1000 Subject: Add take/drop, move jdbc stuff, document default of postgres Add take and drop functionality to the queries, so now you can use the take and drop functions in a similar way to how they work on seqs in clojure. Move jdbc interface stuff into clojure-sql.jdbc, so if you're using jdbc you can include it yourself. (If you're not using jdbc then it shouldn't bother you). Given the default compilation target is actually postgres, document that. --- src/clojure_sql/jdbc.clj | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/clojure_sql/jdbc.clj (limited to 'src/clojure_sql/jdbc.clj') diff --git a/src/clojure_sql/jdbc.clj b/src/clojure_sql/jdbc.clj new file mode 100644 index 0000000..8611336 --- /dev/null +++ b/src/clojure_sql/jdbc.clj @@ -0,0 +1,12 @@ +(ns clojure-sql.jdbc + (:require [clojure.java.jdbc :as jdbc] + [clojure-sql.core :refer [set-query-executor!]])) + +(defn use-jdbc! [connection-string] + (set-query-executor! (fn [type query] + (jdbc/with-connection connection-string + (case type + :select (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))))))) -- cgit v1.2.3