<< Back to previous view

[JDBC-65] Using execute! with no params to insert a row fails on SQLite Created: 09/Jul/13  Updated: 01/Jun/16  Resolved: 16/Dec/13

Status: Closed
Project: java.jdbc
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Sean Corfield Assignee: Sean Corfield
Resolution: Completed Votes: 0
Labels: None


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).

user> (def sqlite-db {:subprotocol "sqlite"
                :subname "clojure_test_sqlite"})
user> (clojure.java.jdbc/db-do-commands sqlite-db (ddl/create-table :test [:col :int]))
user> (clojure.java.jdbc/query sqlite-db ["select * from test"])
user> (execute! sqlite-db ["insert into test values (?)" 42])
user> (clojure.java.jdbc/query sqlite-db ["select * from test"])
({:col 42})
user> (execute! sqlite-db ["insert into test values (123)"])
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})

Comment by Sean Corfield [ 15/Sep/13 4:19 PM ]

Will deal with this during the beta of 0.3.0.

Comment by Sean Corfield [ 16/Dec/13 8:19 PM ]

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

Generated at Mon Jan 22 06:52:09 CST 2018 using JIRA 4.4#649-r158309.