Subject Re: [IBO] TIBOQuery generating invalid SQL "under the hood"
Author Bjørge Sæther
"Helen Borrie" <helebor@...> skrev i melding
news:5.1.0.14.2.20030213101010.02b94dd0@......
> At 09:46 PM 12/02/2003 +0100, you wrote:
> >Hello,
> >
> >I'm having this problem with TIBOQuery modifying SQL under the hood,
> >resulting in invalid SQL:
> >
> >was:
> >SELECT
> > *
> >FROM
> > INVOICE
> >
> >...is modified to:
> >
> >SELECT
> > *
> >, INVOICE.RDB$DB_KEY
> >FROM
> > INVOICE
> >
> >...which won't compile.
> >
> >I surely see what's the problem: Table 'INVOICE' does not exist.
> >But - what's reported is some invalid char ',' - naturally when you see
wh=
> at
> >SQL is being generated.
> >
> >This must be a bug. Agreed ?
>
> No. The ' is not an invalid char. Because your table has no primary
key=20
> and you have set KeyLinksAutoDefine to true, IBO is appending the=20
> RDB$DB_KEY to your select * specification list in order to get a unique=20
> row identifier. The comma is required to extend the list.

OK. The KeyLinksAutoDefine was set to 'true'. It solves the problem of not
being able to select from an unindexed table with "SELECT * FROM...".
But using the DB_KEY is a good idea, once you need to update. It should
probably be used by default, as it is faster and works even when you need to
get rid of indexes. It's just the unqualified "*" that creates problems. The
same statement with TABLE.* makes it all work.

> When you say it "won't compile", what do you mean exactly?

Sorry...I meant "compile" as in "does not generate an error upon Prepare;
call".

Thanks, Helen !

--
Bj�rge S�ther
bjorge@hahaha_itte.no