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

> working with tib_cursor's & tib_query'ies - how to check, is dataset
> empty? query has IsEmpty, but curson doesn't - have tried RowNum,
> but this failed ;) how to emulate IsEmpty for TIB_Dataset ?

IsEmpty is introduced in TIB_BDataset because it doesn't make much
sense for non-buffered datasets. The only way to find out if the set
is empty is to fetch the first record from the server and see what you
get: a record, or an "attempt to fetch past end of output stream"
message. Since a buffered dataset by default fetches some records as
soon as it is opened, it knows whether it's empty or not. (And if it
doesn't, it finds out for you at the moment you read IsEmpty.)

For a TIB_Cursor, you can use the same strategy:

var CursorEmpty: boolean;
MyCursor.APIFirst; // or First, depending on the situation
CursorEmpty := MyCursor.Eof;

Or in C++

bool CursorEmpty = MyCursor->Eof;

RowNum just tells you the number of the current row.

Paul Vinkenoog