Is the documentation right and the code wrong or the other way around?
Is the documentation right and the code wrong or the other way around?
http://docwiki.embarcadero.com/Libraries/XE8/en/Data.DB.TDataSet.IsEmpty
"Indicates whether the dataset contains no records.
Call IsEmpty to determine if a dataset has records. IsEmpty returns true if the dataset does not contain any records. Otherwise it returns false."
Implementation:
function TDataSet.IsEmpty: Boolean;
begin
Result := FActiveRecord >= FRecordCount;
end;
Why do I care?
Because I have seen code like this:
while not ds.IsEmpty do
begin
// stuff
ds.Next;
end;
and it makes me wonder (not seriously) if Next removes records from the dataset ;)
http://docwiki.embarcadero.com/Libraries/XE8/en/Data.DB.TDataSet.IsEmpty
"Indicates whether the dataset contains no records.
Call IsEmpty to determine if a dataset has records. IsEmpty returns true if the dataset does not contain any records. Otherwise it returns false."
Implementation:
function TDataSet.IsEmpty: Boolean;
begin
Result := FActiveRecord >= FRecordCount;
end;
Why do I care?
Because I have seen code like this:
while not ds.IsEmpty do
begin
// stuff
ds.Next;
end;
and it makes me wonder (not seriously) if Next removes records from the dataset ;)
Comments
Post a Comment