java.jdbc

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

Details

  • Type: Defect Defect
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • 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})
{{

Activity

Hide
Sean Corfield added a comment -

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

Show
Sean Corfield added a comment - This turned out to be a bug in how execute! handled empty param group sequences, but only SQLite was affected.
Hide
Sean Corfield added a comment -

Will deal with this during the beta of 0.3.0.

Show
Sean Corfield added a comment - Will deal with this during the beta of 0.3.0.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: