-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 29/02/12 13:28, Richard Hipp wrote:
>> We *could* keep track of each separate CHECK expression and remember
>> the constraint name and evaluate each expression separately and
>> output a customized error message for each failure.  But that would
>> require a lot of extra code space, which is not "lite".

This is just bytecode.  It requires one extra instruction per CHECK.
Currently the code for something like A AND B AND C should look something
like the following since you can abort the processing of an AND the moment
an arm is false.

1. Evaluate A
2. If not true, goto error
3. Evaluate B
4. If not true, goto error
5. Evaluate C
6. If not true, goto error

Inserting an extra opcode to set the error message isn't a huge overhead,
and is required once per arm.  Or whatever is done for 'goto error' could
have a parameter pointing to the string name of the constraint.

A higher level approach depends on a 'raise' function, so A AND B AND C
can be rewritten to (A OR raise('A')) AND (B OR raise('B')) AND (C OR
raise('C'))

There is a reason developers have gone to the trouble of naming their
constraints!

Roger
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEARECAAYFAk9OsrgACgkQmOOfHg372QTqggCgzT+w/n0nsdhvUTVJclICMGUx
FgQAoJLYXSyPLETHPvqD2oSD3m88N6MX
=3vVk
-----END PGP SIGNATURE-----
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to