Subject Re: [ib-support] how do you debug triggers and SPs ?
Author Nando Dessena
Duilio,

> If I could change the message I get from an exception at run time, surely I
> could put the feature to good use in debugging.
>
> I could see if the program goes thru the expected.

if you raise an exception the program won't go any further for sure.
Events are a way to send custom messages to the client, but they are
limited in that you can't pass an expression to POST_EVENT (AFAIK).
So, inspecting the value of local variables is out.

As others have pointed out, existing "debuggers" are rather emulators,
as the only way to enable real debugging is extending the server API.

I happen to use "debug tables" for complex stored procedures (which I
don't write very often, preferring small and simple chunks where
possible). As an example:

create table debug_events (
key integer not null primary key, /* auto-generated */
event_timestamp timestamp, /* should be obvious */
event_source varchar(100), /* table name, stored procedure name or
whatever */
event_description varchar(200) /* what happened */
);

I output debug events with

execute procedure outputdebugevent('mystoredproc', 'before loop: counter
= ' || cast(counter as varchar(10));

Extremely bare, but ofthen enough for me.
Ciao
--
____
_/\/ando