 
 ;;--------------------------------------------------------------------------------
 
+(defn sql-attributes 
+  "Derive a sequence of MetaData attributes from a SQL ResultSet"
+  [#^ResultSetMetaData sql-metadata]
+  (map
+   (fn [column]
+       [(keyword (.getColumnName sql-metadata column))
+	(Class/forName (.getColumnClassName sql-metadata column))
+	true])			 ;we don't know - so assume mutability
+   (range 1 (+ 1 (.getColumnCount sql-metadata)))))
+
+(defn sql-data
+  "Create a sequence from some MetaData and a SQL ResultSet"
+  [#^Metadata metadata #^ResultSet result-set]
+  (let [creator (.getCreator metadata)]
+    (loop [output nil]
+      (if (.next result-set)
+	(recur
+	 (cons
+	  (.create 
+	   creator 
+	   (into-array
+	    Object
+	    (map 
+	     (fn [#^Integer column] (.getObject result-set column))
+	     (range 1 (+ 1 (count (.getAttributeKeys metadata)))))))
+	  output))
+	output))))
+
+;;--------------------------------------------------------------------------------
+
 
 (defn model [#^String model-name version-key #^Metadata metadata]
   (let [version-fn (if version-key

     name
     metadata
     (fn [old new] (> (.get version-getter new) (.get version-getter old))))))

	   DynamicClassLoader
	   ISeq
	   Keyword
	   )
	  (java.sql
	   Connection
	   ResultSet
	   ResultSetMetaData
	   )
	  (java.util
	   Collection
