Fork me on GitHub
Jacob Rosenzweig03:01:41

In next.jdbc is there a way to use next.jdbc/with-options along with next.jdbc/component ? I know that component accepts a db-map and not a ds.

Jacob Rosenzweig03:01:50

For now, I just have my own domain functions that wrap execute! and execute-one! , passing whatever options I want.


I really wish I'd never added with-options 😞

Jakub HolĂ˝ (HolyJak)13:01:01

@seancorfield from

(with-open [con (jdbc/get-connection ds)]
  (with-open [ps (jdbc/prepare con ["..." ...])]
    (jdbc/execute-one! ps nil {...})))
is the nesting necessary? Cannot you write
(with-open [con (jdbc/get-connection ds), ps (jdbc/prepare con ["..." ...])]
  (jdbc/execute-one! ps nil {...}))


You mean, like the next example on that page shows?

;; assuming require next.jdbc.prepare :as p
(with-open [con (jdbc/get-connection ds)
            ps  (jdbc/prepare con ["..."])]
  (jdbc/execute-one! (p/set-parameters ps [...])))
The docs are showing two possible ways to use with-open.

facepalm 1

☝️:skin-tone-2: @holyjak

Jakub HolĂ˝ (HolyJak)18:01:41

Ah, you are 💯 right. I should have seen that. Sorry!


I replied to that issue you opened about execute-batch! -- did you get a chance to try that yet @holyjak?

Jakub HolĂ˝ (HolyJak)19:01:42

I see it but not yet, hope soon..


For folks using Postgres: what connection parameters do you set in production?