From d065a04e181ea2ec9ddf6a5f461b949e10fc4031 Mon Sep 17 00:00:00 2001 From: Sean Corfield Date: Fri, 20 May 2022 10:34:10 -0700 Subject: [PATCH] placeholder (should :array unwrap params?) --- src/honey/sql.cljc | 1 + test/honey/sql_test.cljc | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/honey/sql.cljc b/src/honey/sql.cljc index aef15b4..dc39b7e 100644 --- a/src/honey/sql.cljc +++ b/src/honey/sql.cljc @@ -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 diff --git a/test/honey/sql_test.cljc b/test/honey/sql_test.cljc index b0cdd82..efefb8b 100644 --- a/test/honey/sql_test.cljc +++ b/test/honey/sql_test.cljc @@ -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.