Open johnboy14 opened 8 years ago
The return value depends on the underlying JDBC driver. For MySQL, the driver only returns the generated key:
(exec-raw "create table users (id int auto_increment primary key, name varchar(100))")
=> (0)
(insert :users (values [{:name "foo"}]))
=> {:generated_key 1}
In your case the transform function returns nil if topics is nil and that could be the reason why you're getting nil as return value. I am not completely sure why the transform function is called in the first place but you can fix the transform function in the following way:
(transform (fn [{topics :topics :as v}]
(if topics
(assoc v :topics (split topics #","))
v)))
This solves the problem with the ids so thank you, but my test case did include topics.
When I try to insert the following user, I do not get the last inserted ID as stated in the documentation for the insert function. Instead I just get Nil back. Any idea why this is?. I'm using the latest version and persisting to a MySQL database.