You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Macros are spec-checked if an fdef spec exists, even without calling instrument. The spec for with-transaction requires a literal hash map for options so you cannot pass a variable.
To Reproduce
(~/oss/next-jdbc)-(!2007)-> clj -A:test
Clojure 1.11.1
user=> (require '[next.jdbc :as jdbc])
...
nil
user=> (require 'next.jdbc.specs)
nil
user=> (defdb-spec {:dbtype"h2:mem":dbname"with_t"})
#'user/db-spec
;; this is acceptable:
user=> (jdbc/with-transaction [s db-spec {:rollback-onlytrue}] (jdbc/execute! s ["select * from mytable"]))
Execution error (JdbcSQLSyntaxErrorException) at org.h2.message.DbException/getJdbcSQLException (DbException.java:502).
Table "MYTABLE" not found (this database is empty); SQL statement:
select * from mytable [42104-214]
;; this should be acceptable too:
user=> (let [opts {:rollback-onlytrue}] (jdbc/with-transaction [s db-spec opts] (jdbc/execute! s ["select * from mytable"])))
Syntax error macroexpanding next.jdbc/with-transaction at (REPL:1:35).
opts - failed: map? at: [:binding:opts] spec: :next.jdbc.specs/opts-map
user=>
Expected behavior with-transaction should allow arbitrary forms for the options map. The underlying transact function should trap non-hash-map options, if instrumentation is enabled.
The text was updated successfully, but these errors were encountered:
Describe the bug
Macros are spec-checked if an
fdef
spec exists, even without callinginstrument
. The spec forwith-transaction
requires a literal hash map for options so you cannot pass a variable.To Reproduce
Expected behavior
with-transaction
should allow arbitrary forms for the options map. The underlyingtransact
function should trap non-hash-map options, if instrumentation is enabled.The text was updated successfully, but these errors were encountered: