Using execute! with no params to insert a row fails on SQLite

Description

This is due to executeUpdate. Need to reverify the issues around using executeBatch with no params (since that looks like what db-do-commands does - which works - but executeUpdate was used as a workaround for an issue with no params at some point).
{{{code}}}
user> (def sqlite-db {:subprotocol "sqlite"
:subname "clojure_test_sqlite"})
#'user/sqlite-db
user> (clojure.java.jdbc/db-do-commands sqlite-db (ddl/create-table :test [:col :int]))
(0)
user> (clojure.java.jdbc/query sqlite-db ["select * from test"])
()
user> (execute! sqlite-db ["insert into test values " 42])
(1)
user> (clojure.java.jdbc/query sqlite-db ["select * from test"])
({:col 42})
user> (execute! sqlite-db ["insert into test values (123)"])
nil
user> (clojure.java.jdbc/query sqlite-db ["select * from test"])
({:col 42})
user> (clojure.java.jdbc/insert! sqlite-db :test {:col 123})
({:last_insert_rowid() 2})
user> (clojure.java.jdbc/query sqlite-db ["select * from test"])
({:col 42} {:col 123})
{{{code}}}

Environment

None

Activity

Show:

Sean CorfieldDecember 17, 2013 at 2:19 AM

This turned out to be a bug in how execute! handled empty param group sequences, but only SQLite was affected.

Sean CorfieldSeptember 15, 2013 at 10:19 PM

Will deal with this during the beta of 0.3.0.

Completed

Details

Assignee

Reporter

Priority

Created July 9, 2013 at 5:27 PM
Updated June 1, 2016 at 6:41 PM
Resolved June 1, 2016 at 6:41 PM