Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unique index exception handling for an index on multiple columns in PHP 5.4 #771

Merged
merged 1 commit into from
Jan 11, 2015

Conversation

rbayliss
Copy link
Contributor

In SQLite under PHP 5.4, when I violate a unique index on multiple columns by creating a duplicate record, the PDO Exception thrown is "SQLSTATE[23000]: Integrity constraint violation: 19 columns X, Y are not unique". This PDO exception message is not parsed by the AbstractSQLiteDriver and converted to a UniqueConstraintViolationException as expected, and as happens in PHP 5.5, so only a generic DriverException is thrown, making error handling much harder.

This pull request adds "are not unique" as a string that is checked for in the exception handling code.

@doctrinebot
Copy link

Hello,

thank you for creating this pull request. I have automatically opened an issue
on our Jira Bug Tracker for you. See the issue link:

http://www.doctrine-project.org/jira/browse/DBAL-1111

We use Jira to track the state of pull requests and the versions they got
included in.

@Ocramius Ocramius self-assigned this Jan 11, 2015
Ocramius added a commit that referenced this pull request Jan 11, 2015
Fix unique index exception handling for an index on multiple columns in PHP 5.4
@Ocramius Ocramius merged commit ea293e3 into doctrine:master Jan 11, 2015
Ocramius added a commit that referenced this pull request Jan 11, 2015
@Ocramius
Copy link
Member

@rbayliss merged, thanks!

master: 94e5e55
2.5: 2842400

@rbayliss
Copy link
Contributor Author

Holy smokes that was fast. Thanks!

@Ocramius
Copy link
Member

@rbayliss I just had to wait for travis, heh

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants