Page 1 of 1

OraAlerter

Posted: Fri 15 Aug 2014 18:35
by sinys
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?

Re: OraAlerter

Posted: Mon 18 Aug 2014 09:56
by AlexP
Hello,

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

Re: OraAlerter

Posted: Wed 17 Sep 2014 17:37
by sinys
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.

Re: OraAlerter

Posted: Thu 18 Sep 2014 11:14
by AlexP
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.

Re: OraAlerter

Posted: Thu 25 Sep 2014 17:06
by sinys

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?

Re: OraAlerter

Posted: Fri 26 Sep 2014 09:59
by AlexP
Such behavior is due to using ApplicationHandleException. We will consider the possibility to change this behavior.