issue with updatebatchsize

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Ludek
Posts: 301
Joined: Thu 12 Oct 2006 09:34

issue with updatebatchsize

Post by Ludek » Thu 08 Oct 2015 13:41

i have following big problem optimizing my tmsqueries in cached updates mode.

Following scenario: simple tmsquery, batchupdatesize = 50, cached updates active, sql.text =

Code: Select all

select top 0 id from sysobjects
I'm appending 380 records:

Code: Select all

  Q.Open;
  for i := 1 to 380 do begin
    Q.append;
    Qid.AsInteger := i;
    Q.Post;
  end;
now i want to save the inserts - but only the first 40. so i write following:

Code: Select all

  Q.OnUpdateRecord := Qupdaterecord;
  Q.ApplyUpdates;
  Q.OnUpdateRecord := nil;
  Q.ApplyUpdates;

procedure TForm1.ScheGQUpdateRecord(DataSet: TDataSet; UpdateKind: TUpdateKind;
  var UpdateAction: TUpdateAction);
begin
  if Qid.AsInteger < 40 then
    UpdateAction := uaSkip // should be saved with next call of applyupdates
  else
    UpdateAction := uaApplied; // mark as save, don't save any more
end;

but this code does not save anything!

if i skip more records (more than updatebatchsize)

Code: Select all

procedure TForm1.ScheGQUpdateRecord(DataSet: TDataSet; UpdateKind: TUpdateKind;
  var UpdateAction: TUpdateAction);
begin
  if Qid.AsInteger < 60 then
    UpdateAction := uaSkip // should be saved with next call of applyupdates
  else
    UpdateAction := uaApplied; // mark as save, don't save any more
end;
the first block of 50 gets saved. But the remaining 10 records again hang somewhere.

Please, correct the bug. Or, please, provide some other solution to pre-filter cached updates and save only some of the in one batch.
Thanks, Ludek.

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: issue with updatebatchsize

Post by azyk » Fri 09 Oct 2015 12:38

Thank you for the information. We have reproduced the issue, We will investigate it and inform you as soon as we get any results.

Post Reply