This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-06-28
Channels
- # beginners (33)
- # boot (58)
- # cider (21)
- # cljs-dev (197)
- # cljsrn (112)
- # clojure (136)
- # clojure-belgium (5)
- # clojure-dev (57)
- # clojure-greece (1)
- # clojure-italy (3)
- # clojure-russia (6)
- # clojure-spec (148)
- # clojure-uk (54)
- # clojurescript (29)
- # cursive (24)
- # datomic (36)
- # devops (4)
- # emacs (11)
- # figwheel (1)
- # graphql (18)
- # hoplon (6)
- # leiningen (2)
- # luminus (4)
- # off-topic (7)
- # om (4)
- # onyx (27)
- # precept (1)
- # protorepl (12)
- # quil (1)
- # re-frame (28)
- # reagent (10)
- # ring (9)
- # robots (1)
- # rum (2)
- # slack-help (5)
- # spacemacs (16)
- # sql (16)
- # untangled (16)
- # vim (3)
- # yada (2)
does anyone know of a library that will take a vector of a querystring and parameters such as ["select ? from foo" "bar"]
and render "select bar from foo"
I feel like this would be simple enough to write but the itch isn't big enough at the moment
Can I ask why you want/need this?
@seancorfield debugging purposes mainly
I'd like to be able to copy and paste the generated query into a SQL client and run the query without having to splice the parameters myself
Ah… there’s a JIRA issue to provide a way to retrieve the actual SQL that is run but it’s non-trivial (at least, it seemed so, last time I looked).
There’s also an explain
option that can help with debugging (so you can at least get the query plan being used).
in my case it's actually more of a problem with the source data than with the query that's being generated 😄
Remember that the JDBC driver can do coercion on data so the parameters in the [ ... ]
vector aren’t always what ends up in the SQL query to the DB.
For example, you can pass strings where numbers are expected and they’ll get converted (at least with some drivers).
so ["select * from foo where id = ?" "42"]
will work, even if foo.id
is unsigned int
.