Add error code mapping for "no default value" to MySQL driver

When following error message is shown, then it will get converted to the
correct Exception classs of NotNullConstraintViolationException:

  PDOException: SQLSTATE[HY000]: General error: 1364 Field '...' doesn't have a
  default value
parent caec2672
...@@ -112,6 +112,7 @@ abstract class AbstractMySQLDriver implements Driver, ExceptionConverterDriver, ...@@ -112,6 +112,7 @@ abstract class AbstractMySQLDriver implements Driver, ExceptionConverterDriver,
case '1171': case '1171':
case '1252': case '1252':
case '1263': case '1263':
case '1364':
case '1566': case '1566':
return new Exception\NotNullConstraintViolationException($message, $exception); return new Exception\NotNullConstraintViolationException($message, $exception);
} }
......
...@@ -105,6 +105,7 @@ class AbstractMySQLDriverTest extends AbstractDriverTest ...@@ -105,6 +105,7 @@ class AbstractMySQLDriverTest extends AbstractDriverTest
array('1171', null, null), array('1171', null, null),
array('1252', null, null), array('1252', null, null),
array('1263', null, null), array('1263', null, null),
array('1364', null, null),
array('1566', null, null), array('1566', null, null),
), ),
self::EXCEPTION_SYNTAX_ERROR => array( self::EXCEPTION_SYNTAX_ERROR => array(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment