Fork me on GitHub
#sql
<
2021-02-12
>
richiardiandrea00:02:50

@seancorfield just as FYI you :extend-with-metadata trick in the latest clojure.java.jdbc worked like a charm and this is what I am doing (among other things):

(defn- cast-state-param
  [value]
  (with-meta
    (fn []) ;; meta can only added to clojure objects
    {`clj-jdbc/set-parameter
     (fn [_ ^PreparedStatement stmt ^long i]
       (.setObject stmt i value Types/OTHER))}))

seancorfield02:02:07

@richiardiandrea Cool! With next.jdbc, you'd just be able to call next.jdbc.types/as-other instead of needing to write your own cast function 🙂

richiardiandrea04:02:44

Yeah that sounds like a better approach 😃