Subject Re: [IBO] Problem with TIBOQuery
Author Hans
Hi Helen,,

Well, instead of rewriting existing software and included packages, when
converting from BDE to IBO, don't you think it is more practical to offer at
least all BDE functions at hand and have them functioning like you have a
local dataset? BTW. TIBOTable is missing FlushBuffers function too.

Best Regards
Hans

----- Original Message -----
From: "Helen Borrie" <helebor@...>
To: <IBObjects@yahoogroups.com>
Sent: Tuesday, February 01, 2005 11:25 PM
Subject: Re: [IBO] Problem with TIBOQuery


>
> At 08:51 PM 1/02/2005 -0700, you wrote:
>
>>Hello Helen,
>>
>>Did some more digging and found out that
>>
>>IB_Componets->function TIB_Dataset.SysGetCursorRecordCount: longint;
>>
>>already converts a RecordCount call for
>>
>>'select * from table where such = true'
>>to
>>'select count(*) from table where such = true'
>>
>>at IB_Components->MakeCountSQL( ServerSQL, CountSQL );
>>
>>and uses this modified select to get the proper count as fast as possible
>>:)
>>
>>This conversion is done in IB_Parse->MakeCountSQL
>>
>>Elas, in the case of a 'select * from table union select * from table2' it
>>converts it to
>>
>>'select count(*) from table1 union select * from table2' , which of course
>>results
>>
>>in that at first rather obscure parameter count mismatch error.
>
> Correct.
>
>
>>By simply adding the following two statements before the last statement of
>>this routine
>>
>> ep := getLitSafeStrPos( 'UNION', AnsiUpperCase( CountSQL ), 1 );
>> if ep > 1 then CountSQL := Copy(CountSQL,1,ep-1);
>>
>>CountSQL := Trim( CountSQL );
>>
>>RecordCount now only returns the count of the record of the first select
>>and
>>doesn't
>>raise an exception.
>
> Really useful, right?
>
>
>>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.
>
> ...since you asked...
>
> Helen
>
>
>
>
> ___________________________________________________________________________
> IB Objects - direct, complete, custom connectivity to Firebird or
> InterBase
> without the need for BDE, ODBC or any other layer.
> ___________________________________________________________________________
> http://www.ibobjects.com - your IBO community resource for Tech Info
> papers,
> keyword-searchable FAQ, community code contributions and more !
> Yahoo! Groups Links
>
>
>
>
>
>
>