LauJensen / clojureql

ClojureQL is superior SQL integration for Clojure
https://clojureql.sabrecms.com
Eclipse Public License 1.0
285 stars 39 forks source link

Add ordered keys as meta-data to the result-seq #142

Open rm-hull opened 10 years ago

rm-hull commented 10 years ago

Presently there is no way to determine the order of fields retrieved out of any SQL that was executed, because the row data is slotted into a hash-map, and the ordering is lost. I did consider changing this to use an array-map, but this only works up to 16 elements, and in any regard, this is copy-on-write so performance is not great.

Instead, the ordered keys are added as meta data to the result-seq, so they can be extracted out as follows:

  (with-results [res query]
    (let [cols (:column-names (meta res))]
      ...