sql

All things SQL and JDBC...
this.rob 2020-04-08T17:06:04.206300Z

Thanks @seancorfield, looks good 👍

this.rob 2020-04-08T17:06:18.206700Z

I have another one for you. Although I’m not sure if it belongs here or in #pedestal

this.rob 2020-04-08T17:08:15.207500Z

This bit of code runs fine on its own:

(map #(do (println "-----") %)
       (sql/find-by-keys ds
                         :activities
                         {:user_id 1}
                         {:builder-fn as-unqualified-kebab-maps}))
But when I run it in a pedestal interceptor, the println string is prepended to the output

this.rob 2020-04-08T17:17:14.208900Z

I can replicate the behaviour outside of pedestal. If I bind the result and then pr-str it twice, the first one has all the println mapped values at the start of the list it prints. The second one doesn’t.

this.rob 2020-04-08T17:17:44.209500Z

I’m guessing pedestal is calling pr-str or similar on it when it attaches it to the response as an EDN body

this.rob 2020-04-08T17:22:40.210600Z

okay ignore me - this isn’t anything to do with next.jdbc !

user=> (pr-str (map #(do (println "xyz") %) (range 0 4)))
"(xyz\nxyz\nxyz\nxyz\n0 1 2 3)"

🙂 1
this.rob 2020-04-08T17:25:37.212900Z

and I see it is well documented here: https://clojuredocs.org/clojure.core/pr-str

this.rob 2020-04-08T17:25:50.213300Z

that teaches me for not reading the docs

kirill.salykin 2020-04-08T17:29:14.216300Z

Sean, it currently to set date/time values setTimestampt used. would this work st.setObject(1, localDate)?

kirill.salykin 2020-04-08T17:30:31.218400Z

i think it makes sense to delegate handling of this to db driver, rather the doing it manually? what do you think?

kirill.salykin 2020-04-08T17:30:43.218800Z

happy to prepare the PR

seancorfield 2020-04-08T17:35:18.220600Z

If you do not load next.jdbc.date-time then the default behavior is already setObject( idx, obj )

seancorfield 2020-04-08T17:36:42.221400Z

The point of next.jdbc.date-time is to allow you to override the default setObject behavior when it doesn't do the right thing @kirill.salykin