This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-06-27
Channels
- # announcements (5)
- # aws (2)
- # babashka (2)
- # beginners (79)
- # calva (14)
- # clojure (45)
- # clojure-canada (1)
- # clojure-europe (26)
- # clojuredesign-podcast (14)
- # clojurescript (4)
- # cursive (30)
- # datascript (8)
- # depstar (2)
- # emacs (7)
- # events (1)
- # helix (2)
- # honeysql (4)
- # jobs-discuss (1)
- # off-topic (5)
- # polylith (1)
- # quil (2)
- # reagent (7)
- # shadow-cljs (14)
- # tools-deps (26)
- # xtdb (9)
I am trying to use :param inside :raw because I have an unsupported SQL clause postgres:
(sql/format {:select [:*]
:from [:blah]
:where [:raw ["x >>= " [:param :x]]]})
I don't get where to place the param value - this throws:
missing parameter value for :x
and what worked in honeysql-1:
(sql/format {:select [:*]
:from [:blah]
:where [:raw ["x >>= " [:param :x]]] :params {:x 3}})
Execution error (ExceptionInfo) at honey.sql/format-dsl (sql.cljc:904).
These SQL clauses are unknown or have nil values: :params
does not work in honeysql-2...Just to follow-up on @ilan800’s post -- this works:
dev=> (sql/format {:select [:*]
#_=> :from [:blah]
#_=> :where [:raw ["x >>= " [:param :x]]]}
#_=> {:params {:x 3}})
["SELECT * FROM blah WHERE x >>= ?" 3]
but it's easy enough to just register >>=
as a new binary operator and use it directly:
dev=> (sql/register-op! '>>=)
nil
dev=> (sql/format {:select [:*]
#_=> :from [:blah]
#_=> :where [:>>= :x [:param :x]]}
#_=> {:params {:x 3}})
["SELECT * FROM blah WHERE x >>= ?" 3]