Subject Re: [firebird-support] triggers not working
Author Peter Lee
Thanks for the replies... should I take that in an after insert trigger,
can you not change the values of the inserted record?

Forgive my ignorance regarding how ibo / delphi datasets work, but if
it's a 'before insert' trigger, if I do an query.insert in delphi and
then a query.cancel, I presume the trigger won't have fired?

Thanks,

Peter Lee

Thomas Steinmaurer wrote:

>Hi,
>
>
>
>>I've got a trigger that doesn't seem to be firing. Two tables - one
>>with barcodes, one with products. On the products table, I have a
>>trigger that after insert, grabs an unallocated barcode and assigns it
>>to the new product.
>>
>> select first 1 b.code_check, b.barcode from barcode_upca b where
>>b.used = 0 into new.isbn_check, new.barcode;
>> UPDATE barcode_upca b SET b.used = 1 WHERE b.code_check = new.isbn_check;
>>
>>I'm aware that this is not going to work very well in a multiuser
>>situation, but why doesn't it populate the values? It doesn't seem to
>>work from IBExpert or my Delphi app using IBObjects.
>>
>>
>
>Your trigger needs to be a BEFORE INSERT trigger.
>
>
>
>
>


--
Peter Lee ptle@...
-----------------------------------------------------------------------
Rising Software Australia Pty. Ltd. http://www.risingsoftware.com/
Publishers of 'Auralia' - Ear Training and 'Musition' - Theory Training
Ph: +61 3 9481 3320 FAX: +61 3 9481 3380 USA Freecall: 1 888 667 7839