Subject | Re: [ib-support] how do you debug triggers and SPs ? |
---|---|
Author | Nando Dessena |
Post date | 2002-02-15T14:40:47Z |
Duilio,
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
> If I could change the message I get from an exception at run time, surely Iif you raise an exception the program won't go any further for sure.
> could put the feature to good use in debugging.
>
> I could see if the program goes thru the expected.
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