TOracleDataset as MemoryDataSet

I'm using TOracleDataset in the memory-table mode:

Code:
procedure TFormSelectIn.ods_selectApplyRecord(Sender: TOracleDataSet;
  Action: Char; var Applied: Boolean; var NewRowId: String);
begin
Applied := true;
end;

And TOracleDataSet still performs the Lockpoint operation.

Recording 5000 records into TOracleDataset takes 5 seconds.
If disable Lockpoint operation, recording 5000 records into TOracleDataset takes 0.1 seconds.

How about this code

Code:
if Updating and (LockingMode in [lmCheckImmediate, lmLockDelayed]) then
        LockRecord(False) // Also sets lockpoint
      else
        Lockpoint;
      LockpointSet := True;
      if Inserting then c := 'I' else c := 'U';
      NewRowId := '';
      if ApplyRecord(c, NewRowId) then

change to


Code:
if Inserting then c := 'I' else c := 'U';
      if NOT ApplyRecord(c, NewRowId) then
      begin
         if Updating and (LockingMode in [lmCheckImmediate, lmLockDelayed]) then
           LockRecord(False) // Also sets lockpoint
         else
           Lockpoint;
         LockpointSet := True;
      end;
      NewRowId := '';
      if ApplyRecord(c, NewRowId) then

?
 
Last edited:
test case:

Code:
procedure TForm1.Button1Click(Sender: TObject);
var i : integer;
    n : TDateTime;
begin
OracleSession1.Connected := false;
OracleSession1.Connected := true;

OracleSession1.AutoCommit := true; // obsolete - using only for disable Lockpoint in test case
OracleDataSet1.close;
OracleDataSet1.Open;
OracleDataSet1.DisableControls;
n := now;
for i := 1 to 35000 do begin
   OracleDataSet1.Append;
   OracleDataSet1['id'] := i;
   OracleDataSet1['name'] := i;
   OracleDataSet1.Post;
end;
ShowMessage(VarToStr(MilliSecondsBetween(now, n))); // 312 ms
OracleDataSet1.EnableControls;

OracleSession1.AutoCommit := false;
OracleDataSet1.close;
OracleDataSet1.Open;
OracleDataSet1.DisableControls;
n := now;
for i := 1 to 35000 do begin
   OracleDataSet1.Append;
   OracleDataSet1['id'] := i;
   OracleDataSet1['name'] := i;
   OracleDataSet1.Post;
end;
ShowMessage(VarToStr(MilliSecondsBetween(now, n))); // 6796 ms
OracleDataSet1.EnableControls;
 
Back
Top