Page 1 of 1

"TOraQueue" / "TOraObject" missing

Posted: Mon 25 Jan 2016 14:52
by MDrueck
Hi,

I used "odac710d14pro-1.exe" and "unidac360d14pro.exe" (installed February 2011) until now in a Delphi 2010 project. Now I upgraded to Delphi 10 Seattle and also to "unidac62d23pro.exe".

After opening my project I got an error message saying that TOraSession was not found. After looking here I found out that I have to migrate with the Migration Wizard. I did that, and the project opened with no error. So far so good.

But the source does not compile.

Some code:

Code: Select all

  TfrmMainAOS = class(TForm)
    OraSession: TUniConnection;

function TfrmMainAOS.EnqueueFARMS : Boolean;
var
  OraSQL           : TUniSQL;
  PayLoad          : string;
begin
  Result := False;
  try
    OraSession.ConnectString := edtConnectString.Text;

    PayLoad := Format(mom_out.Lines.Text, [
        XMLDateTimeStr(Int(FStartDate)), XMLDateTimeStr(Int(FEndDate)), XMLDateTimeStr(Now)]);
    OraSQL          := TUniSQL.Create(nil);
    OraSQL.Session  := OraSession;[b] <--- "OraSQL.Session" unknown identifier[/b]
    OraSQL.SQL.Text := 'declare' + #13 +
      '  message       SYS.AQ$_JMS_TEXT_MESSAGE;' + #13 +
      '  agent         sys.aq$_agent   := sys.aq$_agent('' '', null, 0);'+ #13 +
      '  queue_options DBMS_AQ.ENQUEUE_OPTIONS_T;' + #13 +
      '  msg_props     DBMS_AQ.MESSAGE_PROPERTIES_T;' + #13 +
      '  msgid         raw(16);' + #13 +
      'begin' + #13 +
      '  message := sys.aq$_jms_text_message.construct;' + #13 +
      '  message.set_replyto(agent);' + #13 +
      '  message.set_type(''farms'');' + #13 +
      '  message.set_userid(''aquser'');' + #13 +
      '  message.set_appid(''am'');' + #13 +
      '  message.set_text(:text);' + #13 +
      '  DBMS_AQ.ENQUEUE( queue_name         => :FromQueue' + #13 +
      '                 , enqueue_options    => queue_options' + #13 +
      '                 , message_properties => msg_props' + #13 +
      '                 , payload            => message' + #13 +
      '                 , msgid              => msgid);' + #13 +
      'end;';
    OraSQL.Prepare;
    OraSQL.ParamByName('text').AsString      := PayLoad;
    OraSQL.ParamByName('FromQueue').AsString := edtQueueFrom.Text;

    AddResults(Format('SQL.Text:' + #13#10 + '[%s]', [OraSQL.SQL.Text]));
    AddResults('Start: OraSQL.Execute');

    OraSQL.Execute;
    OraSession.Commit;
    AddResults(Format('OraSession.LastError: [%d]', [OraSession.LastError]));[b] <--- "OraSession.LastError" unknown identifier[/b]
This code here is more complicated:

Code: Select all

function TfrmMainAOS.DequeueFARMS : Boolean;
var
  OraQueue         : TOraQueue;
  ObjectPayload    : TOraObject;
  FileName,
  MsgId, PayLoad   : string;
  DoBreak          : Boolean;
  OperationCount   : Integer;
  StartTime        : TDateTime;
begin
  Result := False;
  try
    StartTime := Now;
    OraSession.ConnectString := edtConnectString.Text;

    OraQueue            := TOraQueue.Create(nil);
    OraQueue.Session    := OraSession;
    OraQueue.QueueName  := edtQueueTo.Text;
    OraQueue.DequeueOptions.WaitTimeout := AQ_NO_WAIT;
    try
      Sleep(2000); // etwas warten
      memXMLData.Lines.Clear;
      OperationCount := 0;
      FileName := Format('%s\FARMS To AM %s.xml', [edtTxtImportUpdateFolder.Text, FormatDateTime('YYYY DD MM - HH NN SS', Now)]);
      repeat
        AddResults(Format(#13#10 + 'OperationCount: [%d]', [OperationCount]));
        DoBreak := False;
        repeat
          ObjectPayload := TOraObject.Create;
          try
            MsgId := OraQueue.Dequeue(ObjectPayload);
          except
            on E : Exception do begin
              DoBreak := True;
              Inc(OperationCount);
              AddResults(Format('ERROR: OraQueue.Empty; [%s]', [E.Message]));
            end;
          end;

          if ObjectPayload.AttrIsNull['text_lob'] then begin
            PayLoad := ObjectPayload.AttrAsString['text_vc']
          end else begin
            PayLoad := ObjectPayload.AttrAsLob['text_lob'].AsWideString;
          end;

          AddResults(Format('DEQUEUE: MsgId: [%s]; Length: [%d]', [MsgId, ObjectPayload.AttrAsInteger['text_len']]));

          DoBreak := Pos('>ACK<', PayLoad) > 1;

          memXMLData.Lines.Add(PayLoad);
          OraQueue.Session.Commit;
          ObjectPayload.Free;
        until DoBreak or ((Now - StartTime) > EncodeTime(0, 5, 0, 0));
        AddResults(Format('OraSession.LastError: [%d]', [OraSession.LastError]));
        Sleep(2000); // etwas warten
      until (OperationCount > 10) or ((Now - StartTime) > EncodeTime(0, 5, 0, 0));

      memXMLData.Lines.SaveToFile(FileName);
    finally
      OraQueue.Free;
    end;
    Result := True;
  except
    on E : Exception do begin
      HandleExceptionPrim(E, E.message, 4, 'DequeueFARMS');
    end;
  end;
end;  // DequeueFARMS
I watched in the online help, but could not find any info on how to migrate the code. Any info on how to migrate the code? Any ideas are welcome.

TIA, M. Drück

Re: "TOraQueue" / "TOraObject" missing

Posted: Tue 26 Jan 2016 08:17
by AlexP
Hello,

These are specific components of ODAC, and they are not included in UniDAC. If you want to use TOraQueue, you need to install ODAC.

Re: "TOraQueue" / "TOraObject" missing

Posted: Tue 26 Jan 2016 09:10
by MDrueck
AlexP wrote:These are specific components of ODAC, and they are not included in UniDAC. If you want to use TOraQueue, you need to install ODAC.
In 2011 I bought UniDAC.

Excerpt from the Devart Sales mail:
Thank you for the registration of Universal Data Access Components
Professional team license.

Your developer license number is xxxx.
Please notice it when contacting us.

You can download the full version of UniDAC Professional
at http://secure.devart.com/


So I thought I just have to renew my subscription to UniDAC, what I did. But as it seems now, I bought the wrong product. Any chance to convert my UniDAC license to a ODAC license?

TIA, M. Drück

Re: "TOraQueue" / "TOraObject" missing

Posted: Tue 26 Jan 2016 10:47
by AnastasiyaD
Hi,

Please contact our sales team at sales(at)devart.com so that they can better assist you with the transfer request. Please specify your license number(s) for better assistance.

Thanks in advance.