                        ^String name (.. meta name toString)]]
              [name (.compose type column)])
            (into {})))))
+
+
+(defn abstract-type
+  [value]
+  (if value
+    (condp instance? value
+      Boolean BooleanType/instance
+      ByteBuffer BytesType/instance
+      Double DoubleType/instance
+      Float FloatType/instance
+      InetAddress InetAddressType/instance
+      Integer Int32Type/instance
+      List (ListType/getInstance ^AbstractType (abstract-type (first value)))
+      Map (MapType/getInstance (abstract-type (ffirst value))
+                               (abstract-type (second (first value))))
+      Long LongType/instance
+      Set (SetType/getInstance ^AbstractType (abstract-type (first value)))
+      String UTF8Type/instance
+      UUID UUIDType/instance)
+    EmptyType/instance))
+
+
+(defn- encode-value
+  [value]
+  (let [^AbstractType dbtype (abstract-type value)]
+    (.decompose dbtype value)))
 
 
 ;;; Cassandra protocol implementation.

(defn- do-prepared*
  [{:keys [query-state]} prepared consistency args]
  (let [consistency (kw->consistency consistency)
        result (QueryProcessor/processPrepared prepared consistency query-state (map encode args))]
    (when (instance? ResultMessage$Rows result)
      (decode-resultset (.result ^ResultMessage$Rows result)))))


      (copy (bytebuffer->inputstream bb) baos)
      (.toByteArray baos))))



;;; Helper functions.
