Page 1 of 1

RefreshRecord in ODAC 9.2.5

Posted: Tue 14 Jan 2014 09:02
by cis-wurzen
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.

Re: RefreshRecord in ODAC 9.2.5

Posted: Tue 14 Jan 2014 09:19
by cis-wurzen
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.

Re: RefreshRecord in ODAC 9.2.5

Posted: Tue 14 Jan 2014 10:02
by AlexP
Hello,

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