Following code:
class function TDB.FlagSet(ADataSet: TDataSet; AFieldName: string): Boolean;
var
f: TField;
begin
Result := (ADataSet <> nil) and (not ADataSet.IsEmpty()) and (not ADataSet.Eof);
if Result then begin
f := ADataSet.FindField(AFieldName);
Result := (f <> nil) and f.AsBoolean;
end;
end;
sometimes (very rare cases!) produces an error:
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record
but I have just checked for EOF and it was False!
This started to happen in TDBGrid.OnDrawColumnCell
after I switched the stored procedure caller to [eoAsyncExecute, eoAsyncFetch, eoAsyncFetchNonBlocking]
.
How to assure consistent result set state in TDB.FlagSet
function?