On Wed, Oct 8, 2014 at 12:23 PM, Peter Haworth <p...@lcsql.com> wrote:
> Actually, I do get the CHECK constraint name returned to me in the error
> message otherwise, as you say, it would be impossible to find out what
> failed.
>
> I use a translation table in my application to reformat the SQLite error
> message to a more suitable format to present to my users based on the
> constraint name.

This is really the best you can manage.  The key is to be able to
extract the name of the failing constraint, the name of the unique
index in which a conflict arose, the string passed to RAISE() in a
trigger, then map it to a suitable error message for your application.

If a check expression is complex, well, what can you do but duplicate
parts of it in the application, but if you only have to do that for
error formatting, then using check constraints is still a big win.

Nico
--
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to