On Thu, Mar 5, 2015 at 2:11 AM, silvioprog <silviop...@gmail.com> wrote:

> What do you think about a TDataSetEnumerator class in the DB unit?
> Something like this:
>
> === begin code ===
>
>
function TDataSetEnumerator.MoveNext: Boolean;
> begin
>   Inc(FPosition);
>   if FPosition = FDataSet.RecordCount then
>     Exit(False);
>   FDataSet.MoveBy(FPosition);
>   Result := True;
> end;
>

I'm not sure for FPC but in Delphi there are datasets that do not fully
implement the properties .RecNo and .RecordCount, server cursor datasets
for example always return -1 if memory serves. IMHO the .MoveNext method
should be written in such a way as to not use .RecordCount but only .Eof
which is the only property that is guaranteed to always work correctly in
all datasets.

--
​ ​
​Constantine​
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to