diff options
Diffstat (limited to 'src/clojure_sql/query.clj')
-rw-r--r-- | src/clojure_sql/query.clj | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/src/clojure_sql/query.clj b/src/clojure_sql/query.clj index 239aab4..00eb212 100644 --- a/src/clojure_sql/query.clj +++ b/src/clojure_sql/query.clj @@ -1,20 +1,13 @@ -(ns clojure-sql.query - (:require [clojure-sql.compiler :as c])) +(ns clojure-sql.query) - -(def ^:private ^:dynamic *database-type* nil) -(defn set-database-type! [new-type] - (alter-var-root #'*database-type* (constantly new-type)) - nil) - -(def ^:private ^:dynamic *query-deref-behaviour* #(c/compile-query *database-type* %)) +(def ^:private ^:dynamic *query-deref-behaviour* identity) (defn set-query-deref-behaviour! [f] (alter-var-root #'*query-deref-behaviour* (constantly f)) nil) -(defrecord ^:private Query [] +(defrecord ^:private Query [] clojure.lang.IDeref (deref [this] (*query-deref-behaviour* this))) -(defmethod print-method Query [query writer] - (binding [*out* writer] - (pr (c/compile-query nil query)))) + +(def query? (partial instance? (class (->Query)))) + |