Page 1 of 1

Error change the Connection of a ZQuery - MySQL

Posted: 04.12.2014, 19:41
by WillMometti
Hi,

Error (Access violation at address) to change the Connection of a ZQuery - MySQL.

Example:

   with Query
   begin
     Close;
     Connection: = Database1;
     Open;
   end;

Open properly.

But in the sequel, if I change the Connection error occurs:

   with Query
   begin
     Close;
     Connection: = Database2;
     Open;
   end;


Tested with ZEOSDBO-7.1.4-stable and ZEOSDBO-7.2.0-beta in RAD Studio XE7 with Windows 7.

In Delphi 7 with ZEOSDBO-6.6.6-stable does not occur this error.


Note: I am converting an application from Delphi 7 to XE7.


Please can someone help me?

Thank you.

:o :shock:

Re: Error change the Connection of a ZQuery - MySQL

Posted: 10.12.2014, 23:04
by EgonHugeist
Patch done: R3542 \testing-7.2 (SVN)

You need to replace this function with new code in ZAbstractRODataSet.pas:

Code: Select all

procedure TZAbstractRODataset.SetConnection(Value: TZAbstractConnection);
begin
  if FConnection <> Value then
  begin
    if Active then
       Close;
    Unprepare; <<<<----- was missing
    if FConnection <> nil then
      FConnection.UnregisterDataSet(Self);
    FConnection := Value;
    if FConnection <> nil then
      FConnection.RegisterDataSet(Self);
  end;
end;