Commit ea293e39 authored by Marco Pivetta's avatar Marco Pivetta

Merge pull request #771 from rbayliss/master

Fix unique index exception handling for an index on multiple columns in PHP 5.4
parents 94e5e554 e5845f9b
...@@ -42,6 +42,7 @@ abstract class AbstractSQLiteDriver implements Driver, ExceptionConverterDriver ...@@ -42,6 +42,7 @@ abstract class AbstractSQLiteDriver implements Driver, ExceptionConverterDriver
{ {
if (strpos($exception->getMessage(), 'must be unique') !== false || if (strpos($exception->getMessage(), 'must be unique') !== false ||
strpos($exception->getMessage(), 'is not unique') !== false || strpos($exception->getMessage(), 'is not unique') !== false ||
strpos($exception->getMessage(), 'are not unique') !== false ||
strpos($exception->getMessage(), 'UNIQUE constraint failed') !== false strpos($exception->getMessage(), 'UNIQUE constraint failed') !== false
) { ) {
return new Exception\UniqueConstraintViolationException($message, $exception); return new Exception\UniqueConstraintViolationException($message, $exception);
......
...@@ -71,6 +71,7 @@ class AbstractSQLiteDriverTest extends AbstractDriverTest ...@@ -71,6 +71,7 @@ class AbstractSQLiteDriverTest extends AbstractDriverTest
self::EXCEPTION_UNIQUE_CONSTRAINT_VIOLATION => array( self::EXCEPTION_UNIQUE_CONSTRAINT_VIOLATION => array(
array(null, null, 'must be unique'), array(null, null, 'must be unique'),
array(null, null, 'is not unique'), array(null, null, 'is not unique'),
array(null, null, 'are not unique'),
), ),
); );
} }
......
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