Hi,

It looks like Oracle NUMBER types get mapped to BigDecimal in a result
seq from clojure.java.jdbc. Is there an easy way to configure
clojure.java.jdbc/ResultSet to map Oracle NUMBERS to doubles?

The resultset-seq from 
https://github.com/clojure/java.jdbc/blob/master/src/main/clojure/clojure/java/jdbc/internal.clj
is below.

(defn resultset-seq*
  "Creates and returns a lazy sequence of structmaps corresponding to
   the rows in the java.sql.ResultSet rs. Based on clojure.core/
resultset-seq
   but it respects the current naming strategy."
  [^ResultSet rs]
    (let [rsmeta (.getMetaData rs)
          idxs (range 1 (inc (.getColumnCount rsmeta)))
          keys (map (comp keyword *as-key*)
                    (map (fn [^Integer i] (.getColumnLabel rsmeta i))
idxs))
          check-keys
                (or (apply distinct? keys)
                    (throw (Exception. "ResultSet must have unique
column labels")))
          row-struct (apply create-struct keys)
          row-values (fn [] (map (fn [^Integer i] (.getObject rs i))
idxs))
          rows (fn thisfn []
                 (when (.next rs)
                   (cons (apply struct row-struct (row-values)) (lazy-
seq (thisfn)))))]
      (rows)))

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to