This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-11-28
Channels
- # adventofcode (2)
- # bangalore-clj (3)
- # beginners (171)
- # boot (28)
- # chestnut (3)
- # cljs-dev (20)
- # cljsjs (5)
- # clojure (280)
- # clojure-austin (1)
- # clojure-czech (1)
- # clojure-dev (9)
- # clojure-dusseldorf (2)
- # clojure-greece (20)
- # clojure-italy (6)
- # clojure-poland (16)
- # clojure-russia (7)
- # clojure-serbia (4)
- # clojure-sg (1)
- # clojure-spec (18)
- # clojure-uk (153)
- # clojurescript (57)
- # core-async (9)
- # cursive (21)
- # data-science (29)
- # datomic (18)
- # dirac (8)
- # docker (6)
- # duct (1)
- # emacs (50)
- # fulcro (15)
- # hoplon (56)
- # klipse (3)
- # leiningen (14)
- # lumo (1)
- # off-topic (5)
- # onyx (13)
- # other-languages (14)
- # pedestal (1)
- # perun (5)
- # planck (17)
- # re-frame (10)
- # reagent (2)
- # ring (1)
- # spacemacs (51)
- # sql (14)
- # test-check (16)
- # testing (1)
- # unrepl (93)
hello everyone, I’m using SQLHoney and mysql, is anyone aware of how im supposed to retrieve the generated id? it is returning the number of affected rows (like im doing some multiinsert) although im inserting only one record
You'll only get generated IDs back if you use clojure.java.jdbc
s insert!
directly, I believe. If you use execute!
you won't get generated IDs.
(so I'm not sure how HoneySQL plays into that?)
in that case i guess i should not be using HoneySQL, jdbc/insert! already accepts a nice map as parameter
HoneySQL is great for queries -- I wouldn't use it for anything else, personally. I didn't even know it had insert support...
Ah, interesting... insert-into
...
I guess that could be useful sometimes -- but when using execute!
you will only get the affected row count back, not generated keys. I guess I could add an option to execute!
to attempt to force that...
IIRC I’ve used db-do-prepared
or similar to get generated keys for inserts not mediated by jdbc/insert!
@donaldball That function doesn't return generated keys. Are you thinking of db-do-prepared-return-keys
?
probly
execute!
currently always uses db-do-prepared
, insert!
and insert-multi!
use db-do-prepared-return-keys
if they are called with maps (but not the column variant).
I'm not quite sure why the column variant doesn't (can't?) use the -return-keys
version -- I'd have to investigate. But execute!
certainly could be told to use the -return-keys
variant if multi? true
is not specified -- if I add a new option check there.