On 6 Apr 2012, at 1:50am, BareFeetWare <list....@barefeetware.com> wrote:

> On 06/04/2012, at 12:12 AM, Richard Hipp wrote:
> 
>> 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.

Well, Richard has said that names of constraints which aren't to do with 
foreign keys will be returned in a future version which is already a great 
improvement.

> Please change this. Use a hash table or array or something instead of a 
> counter so SQLite knows what constraint failed.

Actually when I needed to do something similar I ended up building a delimited 
string rather than an array.  String ops seem to be faster than array ops, and 
you have the added advantage that if you do encounter failure and need to 
return which constraints remain, you already have a string suitable for putting 
in the return message.  But I have no idea how SQLite works internally and 
whether this would be appropriate.

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

Reply via email to