RODA BidirecionalDataSets=1 broken

Hi,

I am testing RODA 6.0.58.997 (beta) and I got this error:

Cannot perform operation on unidirecional dataset …

Here my connection string:

AnyDAC?AuxDriver=MySQL;Server=xx;Database=xx;UserID=xx;Password=xx;Port=3306;TinyIntFormat=Integer;BiDirectionalDataSets=1;@ResourceOptions.MacroCreate=False;@ResourceOptions.MacroExpand=False;DirectMode=0

I think BiDirectionalDataSets=1 mode is not working anymore (it works on 6.0.55.957). I did not change my anydac version …

This error occurs in Windows/Delphi and Linux/FPC

I am testing this beta because FPC 2.6.0 64bits support was added…

Thanks
Willian.

Hello,
We couldn’t reproduce this error.
We tested it with:
OS WinXP
Delphi 2010
DA 6.0.58.1001 beta
AnyDAC?AuxDriver=MySQL;Server=localhost;Database=xx;UserID=xx;Password=xx;Port=3306;TinyIntFormat=Integer;BiDirectionalDataSets=1;@ResourceOptions.MacroCreate=False;@ResourceOptions.MacroExpand=False;DirectMode=0
Mysql55
AnyDAC 5.0.3
Can you describe more detail about your project? When does this error occur? Can you send us a small testcase which reproduce this error?

Vovanl,

RO DA 6.0.58.1001
MySQL 5.0
Delphi 7
OS Win 7
AnyDAC 5.0.5

small test case.

Error:
[AnyDAC][Comp][DS]-211. Cannot perform operation on unidirectional dataset [TADQ
uery($028BB6A4)]

program testcase;

uses
SysUtils,
Classes,
uDAInterfaces,
uDAAnyDACDriver,
uDADriverManager,
uDAClasses;

var
conn: IDAConnection;
lDataSet: IDADataSet;
DADriverManager: TDADriverManager;
DAConnectionManager: TDAConnectionManager;
daconn: TDAConnection;
str : string;

begin

// Managers
DAConnectionManager := TDAConnectionManager.Create(nil);
DADriverManager := TDADriverManager.Create(nil);
DAConnectionManager.DriverManager := DADriverManager;

// Conn
daconn := DAConnectionManager.Connections.Add;
daconn.Default := true;
daconn.Name := ‘DB’;

// String
str := ‘AnyDAC?AuxDriver=MySQL;Server=localhost’;
str := str + ‘;Database=database’;
str := str + ‘;UserID=xxx’;
str := str + ‘;Password=yyy’;
str := str + ‘;TinyIntFormat=Integer;BiDirectionalDataSets=1’;
daconn.ConnectionString := str;
daconn.ConnectionType := ‘MySQL’;

// SQL
conn := DAConnectionManager.NewConnection(‘DB’);
ldataset := conn.NewDataset(‘SELECT * FROM SOME_TABLE’,‘SQL’);
lDataSet.Open();

// --> ERROR HERE
ldataSet.Locate(‘SOME_FIELD’,0,[]);
end.

Hello,
Thanks, the issue was logged as #54898
As a workaround please modify uDAAnyDACDriver.pas

procedure TDAEAnyDACConnection.SetupOptions(AOptions: IADStanOptions;
  AFetchMeta: Boolean);
begin
  with AOptions do
  begin
    if not fBiDirectionalDataSets then
      FetchOptions.Unidirectional := True
    else
    FetchOptions.Mode := fmAll;

    if not AFetchMeta then
      FetchOptions.Items := FetchOptions.Items - [fiMeta];
  end;
end;

function TDAEAnyDACConnection.CreateCustomConnection: TCustomConnection;
begin
  fDriverType := mkUnknown;
  FADConnection := TADConnection.Create(nil);
  with FADConnection do begin
    LoginPrompt := False;
    //if not fBiDirectionalDataSets then
    //  FetchOptions.Unidirectional := True
    //else
    //FetchOptions.Mode := fmAll;
    FetchOptions.RowsetSize := 100;
    ResourceOptions.SilentMode := True;
    ResourceOptions.UnifyParams := True;
  end;
  result := FADConnection;
end;

Thanks Vovanl, worked!

I am looking at AnyDAC for Delphi v 5.0.7.2333 bug fixed list:

  • fixed: DataAbstract: “Fetching all records cannot be performed unidirectionally” on any operation
  • fixed: DataAbstract: “Fetching all records cannot be performed unidirectionally” if BiDirectionalDataSets=1

this is related to this issue (54898) ??

If I remove workaround and update anydac driver, bug will disappear ? :slight_smile:

Thanks,
Willian.

Hello,
You wrote:

this is related to this issue (54898) ??

#54898 fix isn’t related to AnyDAC fix.
It will be in the next DA release.