Closed lucassousaf closed 1 year ago
The problem isn't the call to for-insert
but a more fundamental issue that wrapped connectables just don't compose properly at all. When with-options
is wrapped around with-logging
, it works more or less by accident.
I can "solve" the problem by making with-logging
aware of with-options
(several places in the code already special case this, because the default options wrapper is "special" and is baked into a lot of the code) but anyone writing their own wrapped connectables is going to run into this same problem at some point.
Providing default options was a terrible idea -- I caved to various people complaining about having to pass options explicitly, because they didn't want to use the default builders. I wish I'd never budged on that... since it leads directly to problems like this 😒
OK, I've pushed a small change to with-logging
-- can you test against the develop (or the latest 1.3.999-SNAPSHOT) to see if it solves this problem?
Yep, I tested the 1.3.999-SNAPSHOT release and it works fine!
Describe the bug
next.jdbc.sql/insert!
ignores the:options
specified using thenext.jdbc/with-options
wrapper ifnext.jdbc/with-logging
is also used. This only happens if you use thenext.jdbc/with-logging
wrapper after usingnext.jdbc/with-options
. If you use the wrappers in reverse order, everything works as expected.To Reproduce To reproduce run the following code:
The code throws an exception:
If you reverse the order of the wrappers, it works.
Expected behavior The order of the wrappers shouldn't affect the behavior of
next.jdbc.sql/insert!
.project.clj/deps.edn
Environment (please complete the following information):
Additional Context We think that the problem is in the call to
next.jdbc.sql.builder/for-insert
function innext.jdbc.sql/insert!
. It doesn't take into account the nesting of:connectable
s.