package com.codahale.jdub

import scala.collection.JavaConversions._
import java.sql.ResultSet

trait Query[A] extends RawQuery[A] {
  def handle(rs: ResultSet) = {
    val width = rs.getMetaData.getColumnCount
    var results = Vector.empty[Vector[Any]]
    while (rs.next()) {
      var row = Vector.empty[Any]
      for (i <- 1 to width) {
        row = row :+ rs.getObject(i, typeMap)
      }
      results = results :+ row
    }
    reduce(results)
  }

  def reduce(results: Vector[Vector[Any]]): A

  protected def typeMap = Map.empty[String, Class[_]]
}

package com.codahale.jdub

import java.sql.ResultSet

trait Query[A] extends RawQuery[A] {
  def handle(rs: ResultSet) = {
    val width = rs.getMetaData.getColumnCount
    var results = Vector.empty[Vector[Any]]
    while (rs.next()) {
      var row = Vector.empty[Any]
      for (i <- 1 to width) {
        row = row :+ rs.getObject(i)
      }
      results = results :+ row
    }
    reduce(results)
  }

  def reduce(results: Vector[Vector[Any]]): A
}

--- 
+++ 
@@ -1,5 +1,6 @@
 package com.codahale.jdub
 
+import scala.collection.JavaConversions._
 import java.sql.ResultSet
 
 trait Query[A] extends RawQuery[A] {
@@ -9,7 +10,7 @@
     while (rs.next()) {
       var row = Vector.empty[Any]
       for (i <- 1 to width) {
-        row = row :+ rs.getObject(i)
+        row = row :+ rs.getObject(i, typeMap)
       }
       results = results :+ row
     }
@@ -17,4 +18,6 @@
   }
 
   def reduce(results: Vector[Vector[Any]]): A
+
+  protected def typeMap = Map.empty[String, Class[_]]
 }
Allow for type map overrides.
