#1 2012-01-11 12:49:16

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,667
Website

TSQLRestClientURI.BatchUpdate() set mapped fields after FillPrepare

Since revision 1.16 of the framework, the BatchUpdate method will only update the mapped fields if called on a record in which a FillPrepare was performed, and not unmaped (i.e. with no call to FillClose). For instance, in the following code, V.FillPrepare will retrieve only ID and YearOfBirth fields of the TSQLRecordPeople table, so subsequent BatchUpdate(V) calls will only update the YearOfBirth field:

// test BATCH update from partial FillPrepare
  V.FillPrepare(ClientDist,'LastName=:("New"):','ID,YearOfBirth');
  if ClientDist.TransactionBegin(TSQLRecordPeople) then
  try
    Check(ClientDist.BatchStart(TSQLRecordPeople));
    n := 0;
    V.LastName := 'NotTransmitted';
    while V.FillOne do begin
      Check(V.LastName='NotTransmitted');
      Check(V.YearOfBirth=n+1000);
      V.YearOfBirth := n;
      ClientDist.BatchUpdate(V); // will update only V.YearOfBirth
      inc(n);
    end;
  (...)

See http://synopse.info/fossil/info/ad3e9c502e
(in this commit, several issues related to TSQLRestServerStaticInMemory class implementation where also fixed)

Offline

Board footer

Powered by FluxBB