TZAbstractCachedResultSet.DisposeCachedUpdates
Posted: 04.12.2014, 14:10
Hello everyone,
I'm going through the following situation, I wonder if it's a problem or is it something I can change through parameter or setting.
In TZAbstractDataset.Commit method, before the Commit, runs the THack_ZAbstractDataset method (FDatasets ). DisposeCachedUpdates. This is causing me problems.
Here's an example: I have two entries. Each has its TZQuery, one is with CachedUpdates property = True.I'm with two open entries. If I do Commit in the register that the CachedUpdates = false, and have unsaved data in TZQuery standing with CachedUpdates = True, this TZQuery to be recorded raises the exception: 0 record (s) updated. only one
record shouldnt Have Been updated. That is, the Commit method, any change that is in Cache is removed. And in my case it could not be this way.
How could I solve this?
I am grateful for the attention of anyone who can help, and sorry for my bad English.
I'm going through the following situation, I wonder if it's a problem or is it something I can change through parameter or setting.
In TZAbstractDataset.Commit method, before the Commit, runs the THack_ZAbstractDataset method (FDatasets ). DisposeCachedUpdates. This is causing me problems.
Code: Select all
procedure TZAbstractConnection.Commit;
var
ExplicitTran: Boolean;
i: Integer;
begin
CheckConnected;
CheckNonAutoCommitMode;
ExplicitTran := FExplicitTransactionCounter > 0;
if FExplicitTransactionCounter < 2 then
//when 0 then AutoCommit was turned off, when 1 StartTransaction was used
begin
ShowSQLHourGlass;
try
try
for i := 0 to FDatasets.Count -1 do
if Assigned(FDatasets[i]) then
if TObject(FDatasets[i]) is TZAbstractDataset then
THack_ZAbstractDataset(FDatasets[i]).DisposeCachedUpdates;
FConnection.Commit;
finally
FExplicitTransactionCounter := 0;
if ExplicitTran then
AutoCommit := True;
end;
finally
HideSQLHourGlass;
end;
DoCommit;
end
else
Dec(FExplicitTransactionCounter);
end;
record shouldnt Have Been updated. That is, the Commit method, any change that is in Cache is removed. And in my case it could not be this way.
Code: Select all
procedure TZAbstractCachedResultSet.DisposeCachedUpdates;
begin
while FInitialRowsList.Count > 0 do
begin
OldRowAccessor.RowBuffer := PZRowBuffer(FInitialRowsList[0]);
NewRowAccessor.RowBuffer := PZRowBuffer(FCurrentRowsList[0]);
if NewRowAccessor.RowBuffer.UpdateType <> utDeleted then
begin
NewRowAccessor.RowBuffer.UpdateType := utUnmodified;
if (FSelectedRow <> nil)
and (FSelectedRow.Index = NewRowAccessor.RowBuffer.Index) then
FSelectedRow.UpdateType := utUnmodified;
end;
{ Remove cached rows. }
OldRowAccessor.Dispose;
FInitialRowsList.Delete(0);
FCurrentRowsList.Delete(0);
end;
end;
I am grateful for the attention of anyone who can help, and sorry for my bad English.