Delete method not update UpdatesPending in MyQuery

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
C.F.Zwitkovits
Posts: 1
Joined: Sat 25 Mar 2006 20:35

Delete method not update UpdatesPending in MyQuery

Post by C.F.Zwitkovits » Sat 25 Mar 2006 20:48

Hi !!!
I working with MyDac 4.3.10 and Delphi 5.
I call the "Delete" method of the MyQuery component into an Loop :

MyQuery.CachedUpdates := True;
MyQuery.Open;

MyQuery.First;
While not MyQuery.Eof Do
begin
MyQuery.Delete;
MyQuery.Next;
End;

After this loop, I try update the dataset into the Database :

If Not MyConnection.InTransaction Then
MyConnection.StartTransaction;
Try
If MyQuery.UpdatesPending Then <-- FALSE !!!
MyQuery.ApplyUpdates;
MyConnection.Commit;
Except
MyQuery.RestoreUpdates;
MyConnection.Rollback;
Raise;
End;

MyQuery.CommitUpdates;

Is that a bug ??? , Please, Help Me !!!

Thank you

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Mon 27 Mar 2006 14:48

We couldn't reproduce the problem.
Please use a counter to count deleted records:

Code: Select all

  ...
  MyQuery.First;
  i := 0;
  while not MyQuery.Eof do begin
    MyQuery.Delete;
    inc(i);
  end;
  if i = 0 then
    ShowMessage('No records was deleted.');
  ...
If variable i is greater than zero and MyQuery.UpdatesPending=False, send us (mydac*crlab*com) a complete small sample to demonstrate the problem, including script to create and fill table. Also supply us exact version of MySQL server and MySQL client. You can see it in Info sheet of TMyConnection Editor

Post Reply