Advanced debugging event block
White Paper: Advanced debugging event block
The Event Blocks feature allows you to process certain events within IBExpert.
The latest IBExpert version includes a new feature for advanced debugging, but the blocks have to be added from external templates. These are PSQL Debugger events:
Before debugging a PSQL object and On Get modified PSQL source

So, the first block (Before debugging a PSQL object) template now looks as follows:
execute ibeblock (
DatabaseID variant comment 'Internal ID (within IBExpert) of the database associated to the PSQL debugger',
ObjectName variant comment 'PSQL object name',
ObjectType variant comment 'PSQL object type',
PSQLSourceIn variant comment 'PSQL object source to debug')
returns (
PSQLSourceOut variant = null comment 'Modified PSQL source. If NULL or empty, value of PSQLSourceIn will be used')
as
begin
if (ibec_Pos('--$$', PSQLSourceIn) = 0) then
Exit;
SrcLines = ibec_Explode(ibec_CRLF(), PSQLSourceIn);
PSQLSourceOut = '';
foreach (SrcLines as Line key Idx) do
begin
if (ibec_Pos('--$$', Line) > 0) then
Line = ibec_StringReplace(:Line, '--$$', '', __rfReplaceAll) + ' --$$';
PSQLSourceOut = PSQLSourceOut || Line || ibec_CRLF();
end;
end

And the second one (On Get modified PSQL source) template:
execute ibeblock (
DatabaseID variant comment 'Internal ID (within IBExpert) of the database associated to the PSQL debugger',
ObjectName variant comment 'PSQL object name',
ObjectType variant comment 'PSQL object type',
PSQLSourceIn variant comment 'PSQL object source to debug')
returns (
PSQLSourceOut variant = null comment 'Modified PSQL source. If NULL or empty, value of PSQLSourceIn will be used')
as
begin
if (ibec_Pos('--$$', PSQLSourceIn) = 0) then
Exit;
SrcLines = ibec_Explode(ibec_CRLF(), PSQLSourceIn);
PSQLSourceOut = '';
foreach (SrcLines as Line key Idx) do
begin
if (ibec_Pos('--$$', Line) > 0) then
Line = '--$$' || ibec_StringReplace(:Line, '--$$', '', __rfReplaceAll);
PSQLSourceOut = PSQLSourceOut || Line || ibec_CRLF();
end;
end

In practice, this means that you can use the new method of commenting while debugging. To comment you should use following string: --$$. The comment will be removed while in the debugger. For example:
The original source would be something like:
create procedure
returns (id bigint)
as
begin
for
select id
from customer
--$$ where id=123
into id
do
suspend;
end
The before event block will change the code to:
create procedure
returns (id bigint)
as
begin
for
select id
from customer
where id=123 --$$
into id
do
suspend;
end
and the after event block changes the code back before compilation:
create procedure
returns (id bigint)
as
begin
for
select id
from customer
--$$ where id=123
into id
do
suspend;
end
After that, only when the debugger code was changed and the user confirms the changes to be used for the stored procedure.
See also:
Event Blocks
back to top of page
<< ibec_win_GetLastError | IBEBlock | REST example >>







