Hi All
I'm experimenting with Korma querying a SQL Server database using jtds.
My select queries are coming back with net.sourceforge.jtds.jdbc.ClobImpl classes where the field is defined as nvarchar(max) where I would expect a string. It's not terrible but an extra thing to coerce before using my results.
Below is my first hack at a solution. I'm posting here in case there's a better way I'm missing.
The only real pain is that I need to add a transform to every (defentity ...) I define. Perhaps there's a better way.
(into (empty m) (for [[k v] m] [k (f v)])))
"Load data as native clojure type"
(extend-protocol IAsNative
net.sourceforge.jtds.jdbc.ClobImpl
(as-native [o] (-> o (.getCharacterStream) slurp))
(transform (fn [m] (fmap as-native m))))
It's possible that the Microsoft driver is better. I might be making trouble for myself by not using it.
cheers, Oliver