Re: HELP PLEASE -- PL/SQL 'If I'm in debugger, do this'

From: Steve Cosner <stevec_at_zimmer.csufresno.edu>
Date: 1997/03/26
Message-ID: <5hc69d$ajb_at_info.csufresno.edu>#1/1


My favorite method is to set up a parameter named DBG, and set its default value to 'N'. Then I use a key trigger that is not usually used, (key-dupitem, F3) and write the code:

  If :Parameter.DBG = 'N' then --?

     :Parameter.DBG := 'Y';
     Message('  DBG set to Y');
  Else
     :Parameter.DBG := 'N';
     Message('  DBG set to N');

  End if;

Then anywhere I want to do debug-only things (whether or not I am running the debugger), I just code (for example):

    If :Parameter.dbg = 'Y' then
      Message('...'); --?
    End if;
Or better yet:

    dbg_msg('...');--?
and let the dbg_msg procedure test the DBG parameter.

I stick the '--?' comment string in the code so that when I am ready to remove the debugging code, I can search the entire form for all such strings.

At least it works for me...

Regards,
Steve Cosner

In article <33390D5A.7A60_at_entcf3.agw.co.bt.uk>, Alex Heney <heneya_at_entcf3.agw.co.bt.uk> wrote:
>Peter Ball wrote:
>>
>> Hi
>> Is there any way to code a trigger so that if I'm
>> running a form with the debugger on, a test on a system
>> variable will be true and different actions can be coded?
>> eg
>> IF DEBUG.??? = 'Y' then
>> procA
>> ELSE
>> procB
>> END IF;
>>
>
>
>Not directly, but fairly simply indirectly. There are various built-ins
>which will only execute in DEBUG mode.
>
>One of these is BREAK, which can be used in such a way as to execute a
>program unit (by specifying TRIGGER followed by a pl-sql block in the
>parameters to the command). You could run this in a
>WHEN-NEW-FORM-INSTANCE trigger (or anywhere else that seems suitable to
>you), using it to set a value in a variable, if the form is in
>debug-mode. You then test this variable in the code above. You could use
>either a global variable, or a control-block variable. The variable
>would, of course be initialised prior to the break statement to indicate
>that the form was NOT in debug-mode. It would only get reset to indicate
>the form IS in debug-mode if the break statement is executed.
>
>--
>The above posting represents the personal opinions of the author and
>is not to be taken as official (or unofficial) policy or opinions of
>his employer.
>
>Alex Heney, Living in the Global Village.
Received on Wed Mar 26 1997 - 00:00:00 CET

Original text of this message