I'm defining the text of the error message in the schema, in the 
definition of raise, in the trigger definition:

create trigger fki_definitions_words_id before insert on definitions
for each row
begin
    select raise (rollback, 'insert on table definitions violates 
foreign-key constraint fki_definitions_words_id')
where (select _id from words where _id = NEW.owningWordId ) is
null;

The text I expect to see in the thrown exception is:

'insert on table definitions violates foreign-key constraint 
fki_definitions_words_id'

but that's not happening.



----- Original Message ----- 
From: "Simon Slavin" <slav...@hearsay.demon.co.uk>
To: "Jim Showalter" <j...@jimandlisa.com>; "General Discussion of 
SQLite Database" <sqlite-users@sqlite.org>
Sent: Sunday, July 12, 2009 7:44 PM
Subject: Re: [sqlite] Raise is not working


>
> On 13 Jul 2009, at 2:17am, Jim Showalter wrote:
>
>> However, calling insertOrThrow raises SQLiteConstraintException, 
>> which
>> does not contain the text of the raise specified in the schema.
>> Instead, it just has:
>> error code 19: constraint failed
>>
>>
>>
>> Is there any way to get SQLite to honor the message in the raise in
>> the schema definition?
>
> You're the second person to report this problem recently.  Can I ask 
> how you're getting the text of the error message ?  If you just look 
> up 19 it will obviously give you the standard error text for 19, but 
> if you call the functions at
>
> http://www.sqlite.org/c3ref/errcode.html
>
> you should get the right text.
>
> Simon. 

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

Reply via email to