Subject Re: Debugging cascaded updates
Author GrumpyRain
Thanks Helen,

I have a custom dll with an OutputDebugString call in it, so I might
just add a call to that in the triggers and find out which one runs
last when the exception occurs. It would be nice if I could get it to
list all the triggers that are run in order or their execution, but as
I suspected, not possible.

It is much quicker to make a call to ODS('[table name] before delete')
then to set up custom exceptions. It might be a worthwhile exercise to
consolidate all the create / alter trigger statements into a single
patch, but process of elimination should fix this quickly.

Thanks for your help.



--- In firebird-support@yahoogroups.com, Helen Borrie <helebor@t...>
wrote:
> At 03:16 AM 8/11/2004 +0000, you wrote:
>
>
> >OK, let me clear this up, because both responses seem to have missed
> >what I was trying to say.
> >
> >There is no problem with Firebird per se. I am not concerned about the
> >error, it is an invalid typecast style message, I am probably trying
> >to insert a string into an integer field.
> >
> >When I delete the parent record, there are about 30 triggers that fire
> >off. One of those triggers causes this problem. At this stage it looks
> >like I need to remove them one at a time to trace where the error
> >comes from. I just thought there might be a more efficient process of
> >identifying the rogue trigger.
>
> That won't necessarily solve things if you're getting the same error in
> more than one trigger.
>
> You could create a custom exception for the down-track triggers and
alter
> them temporarily to catch the exception you're looking for.
Guessing here
> as to which exception you're tracking (gdscode 335544334,
> isc_convert_error) so substitute it for the actual error you're getting.
>
> create exception debug_me '???????';
> commit;
>
> alter trigger blah_blah
> as
> declare whoami varchar(78);
> begin
> whoami = 'blah_blah';
> begin
> ....
> blah;
> end
> when any do
> begin
> if (gdscode = 335544334) then
> exception debug_me whoami || ' ' || 'has a bad conversion
error';
> else exception;
> end
>
> or, to trap the specific gdscode:
>
> alter trigger blah_blah
> as
> declare whoami varchar(78);
> begin
> whoami = 'blah_blah';
> begin
> ....
> blah;
> end
> when gdscode convert_error do
> exception debug_me whoami || ' ' || 'has a bad conversion error';
> end
>
> If you're likely to be getting more than one type of programmer
error in
> your trigger chain, make the debug error handlers more generalised.
>
> ./hb