On 2 Jul 2009, at 6:35pm, James Gregurich wrote:

> works as expected in the sqlite3 exe.   in C code, I get
> "constraint failed" from sqlite3_errmsg. [...]


> CREATE TRIGGER trig BEFORE INSERT ON test1b
> BEGIN
> SELECT CASE
> WHEN (1)
> THEN RAISE(ABORT, 'no parent element')
> END;

The language in that looks a little strange.  Make your trigger more  
obvious and more like standard SQLite3:

CREATE TRIGGER trig BEFORE INSERT ON test1b
FOR EACH ROW BEGIN
     SELECT RAISE(ABORT, 'no parent element')
     WHERE new.i = 1;
END;

(Note that this will prevent one of your existing table entries.)

See if you still get inconsistent results.  If you don't, make gradual  
changes until it does what you want it to do.  If you still get  
inconsistent results, you're perhaps using the wrong function to fetch  
the text of the error message.

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

Reply via email to