RefreshRecord in ODAC 9.2.5

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
cis-wurzen
Posts: 75
Joined: Tue 04 Jan 2005 10:26

RefreshRecord in ODAC 9.2.5

Post by cis-wurzen » Tue 14 Jan 2014 09:02

In new ODAC version 9.2.5 the RefreshRecord works no longer for subselect. The created Filter contains the full tablename and fieldname which raises an Oracle error.
In version 8.6.11 it works fine.

See sample:

Code: Select all

program OdacRefreshRecordTestSample.dpr;

{$APPTYPE CONSOLE}

uses
  DB, Ora, OraSmart, sysutils;

var
  UserName,Password,Server: String;
  Session: TOraSession;
  QR: TSmartQuery;
begin
  WriteLn('Step 1: Logon');
  Write('Username: ');
  ReadLn(UserName);
  Write('Password: ');
  ReadLn(Password);
  Write('Server: ');
  ReadLn(Server);
  WriteLn('');

  try
    Session := TOraSession.Create(nil);
    try
      //logon to Database
      Session.LoginPrompt := False;
      Session.UserName    := UserName;
      Session.Password    := Password;
      Session.Server      := Server;
      Session.Open;

      //run test
      QR := TSmartQuery.Create(nil);
      try
        QR.Session   := Session;
        QR.Options.FullRefresh := True;
        QR.SQL.Add('SELECT * FROM (');
        QR.SQL.Add('  SELECT D1.DUMMY, D2.DUMMY AS FIELD2');
        QR.SQL.Add('  FROM DUAL D1, DUAL D2');
        QR.SQL.Add('  WHERE D1.DUMMY=D2.DUMMY');
        QR.SQL.Add(')');
        QR.KeyFields     := 'DUMMY';
        QR.UpdatingTable := 'DUAL';

        WriteLn('Step 2: Open Query');
        Writeln(QR.SQL.Text);
        QR.Open;
        try
          Writeln('Step 3: RefreshRecord');
          QR.RefreshRecord;
        except
          on E:Exception do
          begin
            Writeln('RefreshRecord failed. ' + E.Message);
            Readln;
          end;
        end;
      finally
        QR.Free;
      end;

    finally
      Session.Free;
    end;
  except
    on E:Exception do
    begin
      Writeln(E.Message);
      Readln;
    end;
  end;

end.

cis-wurzen
Posts: 75
Joined: Tue 04 Jan 2005 10:26

Re: RefreshRecord in ODAC 9.2.5

Post by cis-wurzen » Tue 14 Jan 2014 09:19

We have searched your code and found a difference in function "GetActualFieldName" bettween ODAC 8.6.11 and 9.2.5.

8.6.11:

Code: Select all

if IsRefresh and (FDataSet.Options.FullRefresh or FDataSet.ReadOnly) and
   not DataSetService.FUpdTableIsArtificial then
9.2.5:

Code: Select all

if IsRefresh and (FFullRefresh or FReadOnly) then
The restriction "UpdTableIsArtificial" has gone.

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

Re: RefreshRecord in ODAC 9.2.5

Post by AlexP » Tue 14 Jan 2014 10:02

Hello,

Thank you for the information. We have reproduced the problem and will fix it in the nearest build.

Post Reply