This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-02-10
Channels
- # beginners (9)
- # boot (8)
- # calva (9)
- # cider (11)
- # cljs-dev (6)
- # clojure (21)
- # clojure-austin (1)
- # clojure-spec (55)
- # clojure-uk (24)
- # clojurescript (30)
- # cursive (1)
- # datomic (3)
- # defnpodcast (1)
- # emacs (3)
- # figwheel-main (9)
- # fulcro (8)
- # jobs-discuss (3)
- # nrepl (7)
- # pathom (8)
- # pedestal (4)
- # perun (4)
- # planck (79)
- # shadow-cljs (46)
- # sql (5)
- # vim (29)
Hi! I was wondering: say you want to make a single update! call, that can update more than one row (where clause matching many), how can I get back the rows that were updated? (db is postgresql)
as I understand it,
(update! db-spec :items {:checked true} ["color like '%black%'"])
=> [17]
adding {:return-keys true}
, returns one row only
@leontalbot figure out how to do it in SQL first. There's no magic in Java.jdbc
-- it's just calling the Postgresql driver to do whatever you tell it.
That said, as noted before, I would not expect :return-keys to do anything sensible on an update (but under the hood all that does is ask the Postgresql driver to return any generated keys on the preparated statement).