GNOME Bugzilla – Bug 729722
Add support for UNIQUE constraint on columns
Last modified: 2014-05-07 15:51:42 UTC
This is quite a common need for applications, for example to ensure that no two users have the same email address. First comit adds support, second commit adds a unit test (in a new test file which could be reused for testing other constraints). Last commit improves error reporting, which is quite important when an insertion into the DB fails because of a violated constraint: you really want to know which constraint on which column is involved.
Created attachment 276075 [details] [review] gom: Add support for UNIQUE constraint on columns
Created attachment 276076 [details] [review] tests: Ensure the UNIQUE constraint works
Created attachment 276077 [details] [review] gom: Improve SQLite error reporting Telling the user that a statement failed because: Failed to execute statement: 19 is not very useful. However, this is much better: Failed to execute statement: UNIQUE constraint failed: items.email
Review of attachment 276075 [details] [review]: Looks good
Attachment 276075 [details] pushed as 9d2d340 - gom: Add support for UNIQUE constraint on columns Attachment 276076 [details] pushed as 7cc9d67 - tests: Ensure the UNIQUE constraint works Attachment 276077 [details] pushed as 795fea1 - gom: Improve SQLite error reporting