Code: Select all
Function LockDataSet(inDataSet: TZAbstractRODataset; inResetFilter: Boolean = False): TDataSetLock;
Begin
If inDataSet = nil Then Exit;
If _lockcount.ContainsKey(inDataSet) Then _lockcount[inDataSet] := _lockcount[inDataSet] + 1
Else _lockcount.Add(inDataSet, 1);
Result.DataSet := inDataSet;
Result.Bookmark := inDataSet.GetBookmark;
Result.AfterScroll := inDataSet.AfterScroll;
Result.Filter := inDataSet.Filter;
Result.FilterSet := Result.Filter <> '';
Result.Sort := inDataSet.SortedFields;
Result.SortType := inDataSet.SortType;
Result.SortSet := Result.Sort <> '';
inDataSet.DisableControls;
inDataSet.AfterScroll := nil;
If inResetFilter And Result.FilterSet Then inDataSet.Filter := '';
If Result.SortSet Then Begin
inDataSet.SortType := stIgnored;
inDataSet.SortedFields := '';
End;
inDataSet.First;
End;
Procedure UnlockDataSet(inDataSetLock: TDataSetLock);
Begin
If inDataSetLock.DataSet = nil Then Exit;
If inDataSetLock.FilterSet Then inDataSetLock.DataSet.Filter := inDataSetLock.Filter;
If inDataSetLock.SortSet Then Begin
inDataSetLock.DataSet.SortedFields := inDataSetLock.Sort;
inDataSetLock.DataSet.SortType := inDataSetLock.SortType;
End;
inDataSetLock.DataSet.GotoBookmark(inDataSetLock.Bookmark);
If _lockcount[inDataSetLock.DataSet] = 1 Then Begin
_lockcount.Remove(inDataSetLock.DataSet);
inDataSetLock.DataSet.EnableControls;
inDataSetLock.DataSet.AfterScroll := inDataSetLock.AfterScroll;
End
Else _lockcount[inDataSetLock.DataSet] := _lockcount[inDataSetLock.DataSet] - 1;
End;
lock1 := LockDataSet(ZQuery1);
lock2 := LockDataSet(ZQuery1);
UnlockDataSet(lock2);
UnlockDataSet(lock1);
The previous build of my application worked flawlessly, but in the new release it started to throw "Bookmark was not found" errors in the unlock's .GotoBookmark. This part of the code was not changed, only that I refreshed the Zeos sources.
Now, the TDataSetLock.Bookmark is initialized by DataSet.GetBookMark, filter is not changed between (so the data is unchanged) but it fails to revert. Is it possible that something broke bookmars for Oracle in the past ~20 days?
Unfortunately - as usual - I can not say which commit worked and which one did not. Previous version of my application was released ~8 days ago, but I'm not sure I was up-to-date with Zeos in Git... especially since I was experimenting with the command line .DCU building...