Page 1 of 1

SQLite 3 Duplicate key error

Posted: 11.12.2012, 15:08
by jjeffman
Is there a way of checking if the SQL error is a duplicate key error ?

Thank you very much.

Posted: 12.12.2012, 07:59
by EgonHugeist
jjeffman,

i'm sorry again. I don't think this is possible because SQLite doesn't provide any Error-Messages and the Result-Codes are less usefull in this case: http://www.sqlite.org/c3ref/c_abort.html

We can only handle/process what we see or getting returned.

Posted: 12.12.2012, 12:48
by jjeffman
Thank you very much.

The application can survive without the error discretization, although it could be better if I it would be possible.

Kind regards.

Posted: 12.12.2012, 13:19
by jjeffman
Looking to the error code list ( 29 different codes ) I have found the SQLITE_CONSTRAINT error, which I think may be used to catch attempts to insert rows with the same key value because it will result in a constraint violation, a primary key or unique constraint.

Thank you very much for point me to the error code list.

Kind regards