Subject Re: [IBO] Problem with TIBOQuery
Author Daniel Rail

At February 2, 2005, 02:25, Helen Borrie wrote:

> At 08:51 PM 1/02/2005 -0700, you wrote:

>>However, I think with a little more work IB_Componets->function
>>TIB_Dataset.SysGetCursorRecordCount can be altered to split and
>>summerize the count(*) of the various unionized selects and thus returns
>>a momentarily correct RecordCount across all unions
>>What do you think ?

> Not useful at all. With UNION sets, the recordcount is not the same as the
> sum of recordcounts of the contributing selects - unless you specify UNION
> ALL (which you rarely do, in practice). You've literally got to fetch the
> entire set and count the output rows.

Essentially, a proper fix can only be implemented once FB 2.0 is
released. Since FB 2.0 will support derived tables, it should be
possible to accurately return the count of a unionized query.

Here's an example of what it might look like for FB 2.0:

select count(*) from (select * from table1 union select * from table2)

For sure, it will be preferable to have the exact same query as the
derived table, that would be just to make sure that there's no
exception generated from a UNION.

Best regards,
Daniel Rail
Senior System Engineer
ACCRA Group Inc. (
ACCRA Med Software Inc. (