OraAlerter

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
sinys
Posts: 186
Joined: Tue 21 Feb 2012 03:44

OraAlerter

Post by sinys » Fri 15 Aug 2014 18:35

XE2 oracle 11.2g odac 9.3.10

Code: Select all

declare v_result integer;
begin
  v_result := dbms_pipe.create_pipe (
      pipename => 'TEST'
    , maxpipesize => 32768
    , private => false
  );
  dbms_pipe.pack_message('A');
  dbms_pipe.pack_message('B');
  v_result := dbms_pipe.send_message('TEST');
end;
/

Code: Select all

OraAlerter1.EventType := etPipe;
OraAlerter1.Events := 'TEST';
OraAlerter1.Interval := 1;
OraAlerter1.Start;

procedure TFrmEventMonitor.OraAlerter1Event(Sender: TObject; Event,
  Message: string);
begin
  OutputMemo.Lines.Add(Message);
end;
I saw only message 'A' without 'B'. Is it a bug or am I doing something wrong? How I can get A and B?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: OraAlerter

Post by AlexP » Mon 18 Aug 2014 09:56

Hello,

Thank you for the information, we have fixed this behaviour, this fix will be included to the next build.

sinys
Posts: 186
Joined: Tue 21 Feb 2012 03:44

Re: OraAlerter

Post by sinys » Wed 17 Sep 2014 17:37

Delphi XE2, ODAC 9.4.11
1)
Different behavion for exception for alert and pipe:

Code: Select all

      try
        OraAlerter1.Start;
      except
        on e : Exception do
            ShowMessage(e.Message);
      end;
Exception correctly catched for etALERT and not catched for etPIPE.
For alert I saw ok message like:

Code: Select all

Please execute GRANT EXECUTE ON DBMS_ALERT TO scott as SYS

ORA-06550: line 2, column 3:
PLS-00201: identifier 'DBMS_ALERT' must be declared
ORA-06550: line 2, column 3:
PL/SQL: Statement ignored
for alert I saw not catched exception like:

Code: Select all

  2.5 Type          : EOraError
  2.6 Message       : ORA-06550:_line 1, column 7:
                      PLS-00201:_identifier 'DBMS_PIPE' must be declared
                      ORA-06550:_line 1, column 7:
                      PL/SQL:_Statement ignored
2)

Code: Select all

declare v_result integer;
begin
  v_result := dbms_pipe.create_pipe (
      pipename => 'TEST'
    , maxpipesize => 32768
    , private => false
  );
  dbms_pipe.pack_message('A');
  dbms_pipe.pack_message('B');
  v_result := dbms_pipe.send_message('TEST');
end;
/

Code: Select all

procedure TFrmEventMonitor.OraAlerter1Event(Sender: TObject; Event,
  Message: string);
var
  s : String;
begin
  s := 'Event on ' + Event + ' ' + DateTimeToStr(Now);
  SMOutput.Lines.Add(s);
  SMOutput.Lines.Add(N_format('', Length(s), '-', False));
  SMOutput.Lines.Add(Message);
  SMOutput.Lines.Add('');
end;
result

Code: Select all

Event on TEST123 18.09.2014 00:50:42
------------------------------------
A

Event on TEST123 18.09.2014 00:50:42
------------------------------------
B
I see it like 2 different message, but it is one message.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: OraAlerter

Post by AlexP » Thu 18 Sep 2014 11:14

We handle and generate this message by ourselves on an attempt to register the event. Since Pipe doesn't require registration, error handling is performed in the common method, and no additional messages are added.
To get the message, we use DBMS_PIPE.Unpack_Message, that returns 2 strings for your PL/SQL code, therefore the event occurs twice.

sinys
Posts: 186
Joined: Tue 21 Feb 2012 03:44

Re: OraAlerter

Post by sinys » Thu 25 Sep 2014 17:06

Code: Select all

  try
        OraAlerter1.Start;
      except
        on e : Exception do
            ShowMessage(e.Message);
      end;
But why I can't catch the exception for Pipe by use standard except block?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: OraAlerter

Post by AlexP » Fri 26 Sep 2014 09:59

Such behavior is due to using ApplicationHandleException. We will consider the possibility to change this behavior.

Post Reply