fixes #363 by improving inlining capability
This commit is contained in:
parent
e44a30a7fd
commit
dae09ff601
4 changed files with 11 additions and 5 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
* 2.0.next in progress
|
||||
* Address #364 by recommending how to handle PostgreSQL operators that contain `@`.
|
||||
* Fix #363 by aligning more closely the semantics of `:inline` syntax with the `:inline true` option. A side effect of this is that `[:inline [:param :foo]]` will now (correctly) inline the value of the parameter `:foo` whereas it previously produced `PARAMS SOURCE`. In addition, inlining has been extended to vector values, so `[:inline ["a" "b" "c"]]` will now produce `('a', 'b', 'c')` and `[:inline [:lift ["a" "b" "c"]]]` will now produce `['a', 'b', 'c']` which is what people seemed to expect (the behavior was previously unspecified).
|
||||
* Support `AS` aliasing in `DELETE FROM`.
|
||||
* Switch from `readme` to `test-doc-blocks` so all documentation is tested!
|
||||
* Clean up build/update deps.
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
For more information, run:
|
||||
|
||||
clojure -A:deps -T:build help/doc"
|
||||
|
||||
(:refer-clojure :exclude [test])
|
||||
(:require [clojure.tools.build.api :as b]
|
||||
[org.corfield.build :as bb]))
|
||||
|
||||
|
|
@ -43,6 +43,11 @@
|
|||
[:test-doc-clj])))))
|
||||
opts)
|
||||
|
||||
(defn test "Run basic tests." [opts]
|
||||
(-> opts
|
||||
(assoc :aliases [:1.10])
|
||||
(bb/run-tests)))
|
||||
|
||||
(defn ci "Run the CI pipeline of tests (and build the JAR)." [opts]
|
||||
(-> opts
|
||||
(bb/clean)
|
||||
|
|
|
|||
|
|
@ -208,6 +208,7 @@
|
|||
(nil? x) "NULL"
|
||||
(string? x) (str \' (str/replace x "'" "''") \')
|
||||
(ident? x) (sql-kw x)
|
||||
(vector? x) (str "[" (str/join ", " (map #'sqlize-value x)) "]")
|
||||
:else (str x)))
|
||||
|
||||
(defn format-entity
|
||||
|
|
@ -1144,9 +1145,8 @@
|
|||
:filter expr-clause-pairs
|
||||
:inline
|
||||
(fn [_ [x]]
|
||||
(if (sequential? x)
|
||||
[(str/join " " (map #'sqlize-value x))]
|
||||
[(sqlize-value x)]))
|
||||
(binding [*inline* true]
|
||||
(format-expr x)))
|
||||
:interval
|
||||
(fn [_ [n units]]
|
||||
(let [[sql & params] (format-expr n)]
|
||||
|
|
|
|||
|
|
@ -447,7 +447,7 @@
|
|||
(format {:dialect :mysql})))))
|
||||
|
||||
(deftest inlined-values-are-stringified-correctly
|
||||
(is (= ["SELECT 'foo', 'It''s a quote!', BAR, NULL"]
|
||||
(is (= ["SELECT 'foo', 'It''s a quote!', bar, NULL"]
|
||||
(format {:select [[[:inline "foo"]]
|
||||
[[:inline "It's a quote!"]]
|
||||
[[:inline :bar]]
|
||||
|
|
|
|||
Loading…
Reference in a new issue