Page 1 of 1

issue with updatebatchsize

Posted: Thu 08 Oct 2015 13:41
by Ludek
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.

Re: issue with updatebatchsize

Posted: Fri 09 Oct 2015 12:38
by azyk
Thank you for the information. We have reproduced the issue, We will investigate it and inform you as soon as we get any results.