diff --git a/scalasql/core/src/DialectTypeMappers.scala b/scalasql/core/src/DialectTypeMappers.scala index 3e4783f..f6311dc 100644 --- a/scalasql/core/src/DialectTypeMappers.scala +++ b/scalasql/core/src/DialectTypeMappers.scala @@ -23,6 +23,7 @@ trait DialectTypeMappers extends DialectConfig { implicit def IntType: TypeMapper[Int] implicit def LongType: TypeMapper[Long] + implicit def FloatType: TypeMapper[Float] implicit def DoubleType: TypeMapper[Double] implicit def BigDecimalType: TypeMapper[scala.math.BigDecimal] implicit def BooleanType: TypeMapper[Boolean] diff --git a/scalasql/core/src/TypeMapper.scala b/scalasql/core/src/TypeMapper.scala index d855570..23aec39 100644 --- a/scalasql/core/src/TypeMapper.scala +++ b/scalasql/core/src/TypeMapper.scala @@ -87,7 +87,8 @@ object TypeMapper { d.IntType implicit def longFromDialectTypeMappers(implicit d: DialectTypeMappers): TypeMapper[Long] = d.LongType - + implicit def floatFromDialectTypeMappers(implicit d: DialectTypeMappers): TypeMapper[Float] = + d.FloatType implicit def doubleFromDialectTypeMappers(implicit d: DialectTypeMappers): TypeMapper[Double] = d.DoubleType implicit def bigDecimalFromDialectTypeMappers( diff --git a/scalasql/src/dialects/Dialect.scala b/scalasql/src/dialects/Dialect.scala index 64a1fc6..8dd9183 100644 --- a/scalasql/src/dialects/Dialect.scala +++ b/scalasql/src/dialects/Dialect.scala @@ -62,6 +62,13 @@ trait Dialect extends DialectTypeMappers { def put(r: PreparedStatement, idx: Int, v: Long) = r.setLong(idx, v) } + implicit def FloatType: TypeMapper[Float] = new FloatType + class FloatType extends TypeMapper[Float] { + def jdbcType = JDBCType.FLOAT + def get(r: ResultSet, idx: Int) = r.getFloat(idx) + def put(r: PreparedStatement, idx: Int, v: Float) = r.setFloat(idx, v) + } + implicit def DoubleType: TypeMapper[Double] = new DoubleType class DoubleType extends TypeMapper[Double] { def jdbcType = JDBCType.DOUBLE @@ -197,12 +204,18 @@ trait Dialect extends DialectTypeMappers { def put(r: PreparedStatement, idx: Int, v: T) = r.setObject(idx, v, java.sql.Types.OTHER) } + implicit def from(x: Byte): Expr[Byte] = Expr(x) + + implicit def from(x: Short): Expr[Short] = Expr(x) + implicit def from(x: Int): Expr[Int] = Expr(x) implicit def from(x: Long): Expr[Long] = Expr(x) implicit def from(x: Boolean): Expr[Boolean] = Expr.apply0(x, x) + implicit def from(x: Float): Expr[Float] = Expr(x) + implicit def from(x: Double): Expr[Double] = Expr(x) implicit def from(x: scala.math.BigDecimal): Expr[scala.math.BigDecimal] = Expr(x)