Permalink
Browse files

Fix mysql parse b'0'

  • Loading branch information...
trevorsibanda committed Jun 9, 2017
1 parent ba6effb commit 474c04a38d28e05c85cb3487301eec250e37fd34
@@ -1,3 +1,4 @@
CREATE TABLE `LongTextTest`( entry1 LONGTEXT NOT NULL , entry2 MEDIUMTEXT NOT NULL , entry3 TEXT NOT NULL , entry4 VARCHAR(255) NOT NULL );
CREATE TABLE DEFAULT_NUMERIC( d0 decimal(13,2) NOT NULL DEFAULT '0.00',d1 decimal(13) NOT NULL DEFAULT 0.00, d3 INT NOT NULL DEFAULT '0.00' );
CREATE TABLE `table_name`( id INT NOT NULL, si SMALLINT NOT NULL, mi MEDIUMINT NOT NULL, bi BIGINT NOT NULL );
CREATE TABLE `bit_test`(b1 BIT NOT NULL, b2 BIT NOT NULL DEFAULT b'0', b3 BIT NOT NULL DEFAULT b'1');
@@ -179,9 +179,12 @@ val SimpleA = CustomTyping.SimpleA
| assertType(TableName.baseTableRow.si, "Int")
| assertType(TableName.baseTableRow.mi, "Int")
| assertType(TableName.baseTableRow.bi, "Long")
| val bitEntries = Seq(BitTestRow(true), BitTestRow(false, true, true))
| DBIO.seq(
| schema.create,
| TableName += TableNameRow(0, 0, 0, 0),
| BitTest ++= bitEntries,
| BitTest.result.map{assertEquals(_, bitEntries)},
| TableName.result.map{ case rows: Seq[TableNameRow] => assert(rows.length == 1) },
| DefaultNumeric += entry,
| DefaultNumeric.result.head.map{ r => assertEquals(r , entry) }
@@ -80,8 +80,8 @@ trait MySQLProfile extends JdbcProfile { profile =>
override def createColumnBuilder(tableBuilder: TableBuilder, meta: MColumn): ColumnBuilder = new ColumnBuilder(tableBuilder, meta) {
override def default = meta.columnDef.map((_,tpe)).collect{
case (v,"String") => Some(Some(v))
case ("1","Boolean") => Some(Some(true))
case ("0","Boolean") => Some(Some(false))
case ("1"|"b'1'", "Boolean") => Some(Some(true))
case ("0"|"b'0'", "Boolean") => Some(Some(false))
case ( v , "scala.math.BigDecimal") => Some( Some( scala.math.BigDecimal(v) ) )
}.getOrElse{
val d = super.default

0 comments on commit 474c04a

Please sign in to comment.