sql

All things SQL and JDBC...
richiardiandrea 2021-02-12T00:20:50.071Z

@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))}))

seancorfield 2021-02-12T02:44:07.071900Z

@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 🙂

richiardiandrea 2021-02-12T04:27:44.072Z

Yeah that sounds like a better approach 😃