   ^SQLTemplate [sql param-pairs result-column-types]
   (when-not (string? sql)
     (unexpected "SQL string" sql))
-  (when-not (and (vector? param-pairs)
-              (every? vector? param-pairs)
-              (every? #(<= 1 (count %) 2) param-pairs))
-    (unexpected "param-pairs vector with 1 or 2 element vectors of param name and optional type" param-pairs))
-  (when-not (vector? result-column-types)
-    (unexpected "result-column-types vector" result-column-types))
-  (let [param-types (map second param-pairs)]
-    (when-not (every? #(contains? supported-sql-types %) param-types)
-      (unexpected (str "every param type to be one of " supported-sql-types) param-pairs)))
-  (when-not (every? #(contains? supported-sql-types %) result-column-types)
-    (unexpected (str "every result column type to be one of " supported-sql-types) result-column-types))
-  (->SQLTemplate sql
-    ;; param names and types
-    (->> param-pairs
-      (map (fn [[k t]] [k (get sql-type-map t)]))
-      object-array)
-    ;; result types
-    (->> result-column-types
-      (map sql-type-map)
-      int-array)))
+  (->SQLTemplate sql (object-array param-pairs) (int-array result-column-types)))
 
 
 ;; ----- SQL parsing helpers -----
+
+
+(def encode-name keyword)
+
+
+(defn encode-type
+  [^String token ^String sql]
+  (let [k (keyword token)]
+    (when-not (contains? sql-type-map k)
+      (unexpected (str supported-sql-types " in SQL string: " sql) token))
+    (get sql-type-map k)))
 
 
 (defn valid-type-char?

      #_sql-string     11 (.getString    result-set column-index)
      #_sql-time       12 (.getTime      result-set column-index)
      #_sql-timestamp  13 (.getTimestamp result-set column-index)
      (unexpected (str "either of " (pr-str supported-sql-types)) column-type))))


(defn read-result-row

                   :timestamp  sql-timestamp})


(def supported-sql-types (str "either of " (->> (keys sql-type-map)
                                             (remove nil?)
                                             (map name)
                                             (str/join ", "))))


(defrecord SQLTemplate
