[fpc-pascal] Suggestion: TDataSetEnumerator
Constantine Yannakopoulos
alfasud.ti at gmail.com
Thu Mar 5 10:48:23 CET 2015
On Thu, Mar 5, 2015 at 2:11 AM, silvioprog <silvioprog at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20150305/2750d2e1/attachment.html>
More information about the fpc-pascal
mailing list