Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: TFDPhysADSEventAlerter.DoFired shows EVariantTypeCastError


This question is answered.


Permlink Replies: 1 - Last Post: Apr 8, 2017 11:20 PM Last Post By: Dmitry Arefiev
Joachim Breuer

Posts: 14
Registered: 4/10/03
TFDPhysADSEventAlerter.DoFired shows EVariantTypeCastError  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 6, 2017 7:55 AM
With Delphi 10.2 TOKYO RSP-15023 is fixed and I can go on with implementing TFDEventAlerter using Advantage Database Server 11.0.0.30.

But now I'm getting EVariantTypeCastError mit der Meldung 'Variante des Typs (Null) konnte nicht in Typ (OleStr) konvertiert werden' aufgetreten.

after my trigger was fired.

My after-update-trigger fires EXECUTE PROCEDURE sp_SignalEvent('event_MyEvent', false, 0);

and my delphi code is:

  FDEventAlerter.Names.Add('event_MyEvent');
  FDEventAlerter.Options.Kind := 'Events';
  FDEventAlerter.Options.Synchronize := True;
  FDEventAlerter.Options.Timeout := 10000;
  FDEventAlerter.Active := True;
  FDEventAlerter.Register;


Something wrong or missing?

The error occurs in TFDPhysADSEventMessage.Create because oRow.GetData(2) gives Null back

procedure TFDPhysADSEventAlerter.DoFired;
var
  i: Integer;
  oRow: TFDDatSRow;
begin
  try
    if FTab.Columns.Count = 0 then
      FWaitCommand.Define(FTab);
    FWaitCommand.Fetch(FTab);
    for i := 0 to FTab.Rows.Count - 1 do begin
      oRow := FTab.Rows[i];
      if (oRow.GetData(1) <> 0) and
         (CompareText(oRow.GetData(0), C_WakeUpEvent) <> 0) then
        FMsgThread.EnqueueMsg(TFDPhysADSEventMessage.Create(
          oRow.GetData(0), oRow.GetData(1), oRow.GetData(2)));
    end;
  finally
    FTab.Clear;
  end;
end;
Dmitry Arefiev

Posts: 1,406
Registered: 12/7/03
Re: TFDPhysADSEventAlerter.DoFired shows EVariantTypeCastError
Correct
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 8, 2017 11:20 PM   in response to: Joachim Breuer in response to: Joachim Breuer
Two options:

My after-update-trigger fires EXECUTE PROCEDURE sp_SignalEvent('event_MyEvent', false, 0);

Use another sp_SignalEvent version with 4 arguments, and supply what ever you want as 4'd argument value.

The error occurs in TFDPhysADSEventMessage.Create because oRow.GetData(2) gives Null back

Or replace oRow.GetData(2) with VarToStr(oRow.GetData(2)).

--
With best regards,
Dmitry
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02