Subject Re: [IBO] is dataset empty
Author Paul Vinkenoog
Hi Gediminas,

> The behaviour of TIB_Cursor wrt Bof and Eof on an empty dataset
> turns out to be:
>
> 1: Cursor prepared, but not yet opened (no Open, no First or
> APIFirst executed): Bof true, Eof false.
>
> 2: After First or APIFirst: Bof false (!), Eof true.

Wrong. I tested with APIFirst and assumed First would give the same
result. But as Luc wrote (and I just verified it -- never trust a
fellow programmer :-)) after First on an empty cursor, both Bof and
Eof are true.

OTOH: it doesn't matter *that* much, because after First or APIFirst,
testing for Eof alone is enough.

> 3. Immediately after an explicit Open: Bof true, Eof true -- but
> only if Active was false before the call to Open.

...AND if AutoFetchFirst is true! Better forget about Open. IMO the
simplest test is:

- call APIFirst or First
- then test Eof

Bottom line: you MUST try to fetch a record to find out if the set
is empty.

Enough for today - now my head is empty :-)

Greetings,
Paul Vinkenoog