On Thu, Apr 5, 2012 at 10:08 AM, Gert Corthout <gert_corth...@hotmail.com>wrote:

>
> hi all,
> I have the database set to fail in case of constraint violation. And it
> does return SQLITE_CONSTRAINT from sqlite3_step when I try to insert/update
> an invalid foreign key. But is there any way to find out exactly which
> constraint failed as I might have many foreign key fields in the record.
>

The latest code on trunk will tell you which CHECK constraint failed.  But
SQLite doesn't know which foreign key constraint failed.  The way SQLite
keeps track of foreign key constraints is by use of a counter.  When
foreign key constraints are violated, the counter increments and when the
constraints are resolved, the counter decrements, and an error is issued at
transaction commit if the counter is not zero.  But if the counter is not
zero, we don't have any way of knowing which of the many constraints caused
the problem.




> thanks in advance,Gert
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to