be clear that these are field accessors

not function calls
This commit is contained in:
Mike Blume 2015-06-15 15:43:58 -07:00
parent d792a9d285
commit 04a7086687
2 changed files with 9 additions and 9 deletions

View file

@ -323,11 +323,11 @@
SqlCall SqlCall
(-to-sql [x] (-to-sql [x]
(binding [*fn-context?* true] (binding [*fn-context?* true]
(let [fn-name (name (.name x)) (let [fn-name (name (.-name x))
fn-name (fn-aliases fn-name fn-name)] fn-name (fn-aliases fn-name fn-name)]
(apply fn-handler fn-name (.args x))))) (apply fn-handler fn-name (.-args x)))))
SqlRaw SqlRaw
(-to-sql [x] (.s x)) (-to-sql [x] (.-s x))
clojure.lang.IPersistentMap clojure.lang.IPersistentMap
(-to-sql [x] (-to-sql [x]
(let [clause-ops (sort-clauses (keys x)) (let [clause-ops (sort-clauses (keys x))
@ -354,7 +354,7 @@
(add-param pname x))))) (add-param pname x)))))
SqlArray SqlArray
(-to-sql [x] (-to-sql [x]
(str "ARRAY[" (comma-join (map -to-sql (.values x))) "]")) (str "ARRAY[" (comma-join (map -to-sql (.-values x))) "]"))
Object Object
(-to-sql [x] (-to-sql [x]
(add-anon-param x))) (add-anon-param x)))

View file

@ -23,7 +23,7 @@
(apply (resolve `call) form)) (apply (resolve `call) form))
(defmethod print-method SqlCall [^SqlCall o ^java.io.Writer w] (defmethod print-method SqlCall [^SqlCall o ^java.io.Writer w]
(.write w (str "#sql/call " (pr-str (into [(.name o)] (.args o)))))) (.write w (str "#sql/call " (pr-str (into [(.-name o)] (.-args o))))))
(defmethod print-dup SqlCall [o w] (defmethod print-dup SqlCall [o w]
(print-method o w)) (print-method o w))
@ -48,7 +48,7 @@
((resolve `raw) form)) ((resolve `raw) form))
(defmethod print-method SqlRaw [^SqlRaw o ^java.io.Writer w] (defmethod print-method SqlRaw [^SqlRaw o ^java.io.Writer w]
(.write w (str "#sql/raw " (pr-str (.s o))))) (.write w (str "#sql/raw " (pr-str (.-s o)))))
(defmethod print-dup SqlRaw [o w] (defmethod print-dup SqlRaw [o w]
(print-method o w)) (print-method o w))
@ -76,7 +76,7 @@
((resolve `param) form)) ((resolve `param) form))
(defmethod print-method SqlParam [^SqlParam o ^java.io.Writer w] (defmethod print-method SqlParam [^SqlParam o ^java.io.Writer w]
(.write w (str "#sql/param " (pr-str (.name o))))) (.write w (str "#sql/param " (pr-str (.-name o)))))
(defmethod print-dup SqlParam [o w] (defmethod print-dup SqlParam [o w]
(print-method o w)) (print-method o w))
@ -97,14 +97,14 @@
(SqlArray. values nil)) (SqlArray. values nil))
(defn array-vals [^SqlArray a] (defn array-vals [^SqlArray a]
(.values a)) (.-values a))
(defn read-sql-array [form] (defn read-sql-array [form]
;; late bind, as above ;; late bind, as above
((resolve `array) form)) ((resolve `array) form))
(defmethod print-method SqlArray [^SqlArray a ^java.io.Writer w] (defmethod print-method SqlArray [^SqlArray a ^java.io.Writer w]
(.write w (str "#sql/array " (pr-str (.values a))))) (.write w (str "#sql/array " (pr-str (.-values a)))))
(defmethod print-dup SqlArray [a w] (defmethod print-dup SqlArray [a w]
(print-method a w)) (print-method a w))