placeholder (should :array unwrap params?)

This commit is contained in:
Sean Corfield 2022-05-20 10:34:10 -07:00
parent 5fe73c75bc
commit d065a04e18
2 changed files with 8 additions and 1 deletions

View file

@ -1235,6 +1235,7 @@
">")])
:array
(fn [_ [arr]]
;; allow for (unwrap arr) here?
(let [[sqls params] (format-expr-list arr)]
(into [(str "ARRAY[" (str/join ", " sqls) "]")] params)))
:between

View file

@ -207,7 +207,13 @@
(is (= (format {:insert-into :foo
:columns [:baz]
:values [[[:array ["one" "two" "three"]]]]})
["INSERT INTO foo (baz) VALUES (ARRAY[?, ?, ?])" "one" "two" "three"])))
["INSERT INTO foo (baz) VALUES (ARRAY[?, ?, ?])" "one" "two" "three"]))
#_ ;; requested feature -- does not work yet
(is (= (format {:insert-into :foo
:columns [:baz]
:values [[[:array :?vals]]]}
{:params {:vals [1 2 3 4]}})
["INSERT INTO foo (baz) VALUES (ARRAY[?, ?, ?, ?])" 1 2 3 4])))
(deftest union-test
;; UNION and INTERSECT subexpressions should not be parenthesized.