Permalink
Browse files

SQlServer use Short instead of Byte for TINYINT

  • Loading branch information...
1 parent c435316 commit 443af071ae0391402353c2ee43a77b7f0ca0cdfd @trevorsibanda trevorsibanda committed Aug 22, 2016
Showing with 8 additions and 1 deletion.
  1. +8 −1 slick/src/main/scala/slick/jdbc/SQLServerProfile.scala
@@ -1,7 +1,7 @@
package slick.jdbc
import scala.concurrent.ExecutionContext
-
+import scala.reflect.{ClassTag,classTag}
import java.sql.{Timestamp, Date, Time, ResultSet}
import com.typesafe.config.Config
@@ -102,6 +102,13 @@ trait SQLServerProfile extends JdbcProfile {
case ("1","Boolean") => Some(true)
}.map(d => Some(d)).getOrElse{super.default}
}
+ override def jdbcTypeToScala(jdbcType: Int, typeName: String = ""): ClassTag[_] = {
+ //SQL Server's TINYINT type is unsigned while Scala's Byte is signed
+ if( jdbcType == java.sql.Types.TINYINT )
+ classTag[Short]
+ else
+ super.jdbcTypeToScala( jdbcType , typeName )
+ }
}
override def createModelBuilder(tables: Seq[MTable], ignoreInvalidDefaults: Boolean)(implicit ec: ExecutionContext): JdbcModelBuilder =

0 comments on commit 443af07

Please sign in to comment.