<< Back to previous view

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

Status: Resolved
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


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

}}
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})
{{



 Comments   
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 Nov 24 02:26:38 CST 2014 using JIRA 4.4#649-r158309.