Subject | RE: [IBO] SubSelect as Orderingitem in TIB_Query |
---|---|
Author | Kaputnik |
Post date | 2001-05-08T19:41:04Z |
When you take a look at the SQL-monitor while opening an ordered dataset
with Fethwholerows set to false, you will see, that a statement SELECT (PK)
FROM Table ORDER BY (COLUMN) is set up to fill the ordered small buffer, and
a larger select with all columns in it with WHERE (PK)=parameter to fill the
larger buffer just in time....
so, IBO will prepare your subselect-statement not really as subselect, but
only a minimalistic select from the base-table, but ordered by the
sub-select column...this will result in a fatal error!
The workaround is simple: Set FetchWholeRows to TRUE !! This way, the
double-buffering will be disabled (really a pity in most cases, this makes
naviagting large results painless) but will enable sorting by the sub-select
columns...
ah, and IB/FB will not recognise column-names of sub-selects in the order-by
clause,even if you set them explicit...use the column-number as
ordering-item (attention, the column-numbers are 1-based, not 0-based!!)
CU, Kaputnik
(Nick Josipovic)
nick@... <mailto:nick@...>
kap@... <mailto:kap@...>
--------------------------------------------------------------
superior Client/Server programming:
www.IBObjects.com <http://www.IBObjects.com>
a nice tool for Interbase:
www.InterbaseWorkbench.com <http://www.InterbaseWorkbench.com>
with Fethwholerows set to false, you will see, that a statement SELECT (PK)
FROM Table ORDER BY (COLUMN) is set up to fill the ordered small buffer, and
a larger select with all columns in it with WHERE (PK)=parameter to fill the
larger buffer just in time....
so, IBO will prepare your subselect-statement not really as subselect, but
only a minimalistic select from the base-table, but ordered by the
sub-select column...this will result in a fatal error!
The workaround is simple: Set FetchWholeRows to TRUE !! This way, the
double-buffering will be disabled (really a pity in most cases, this makes
naviagting large results painless) but will enable sorting by the sub-select
columns...
ah, and IB/FB will not recognise column-names of sub-selects in the order-by
clause,even if you set them explicit...use the column-number as
ordering-item (attention, the column-numbers are 1-based, not 0-based!!)
CU, Kaputnik
(Nick Josipovic)
nick@... <mailto:nick@...>
kap@... <mailto:kap@...>
--------------------------------------------------------------
superior Client/Server programming:
www.IBObjects.com <http://www.IBObjects.com>
a nice tool for Interbase:
www.InterbaseWorkbench.com <http://www.InterbaseWorkbench.com>
> -----Original Message-----
> From: Jörg Schiemann [mailto:schimmi@...]
> Sent: Tuesday, May 08, 2001 2:53 PM
> To: IBObjects@yahoogroups.com
> Subject: [IBO] SubSelect as Orderingitem in TIB_Query
>
>
> Hi,
>
> It doesn't seems do work, to have a subselect column as a orderingitem, or
> am I doing something wrong?
>
> thanks in advance,
> Jörg
>