Subject Re: [IBO] TIB_Query: Problem with SQL Parsing?
Author Calin Iancu Pirtea
----- Original Message -----
From: "Jason Wharton"

> > ----------------
> > SELECT
> > *
> > FROM
> > DEALS
> > ----------------
> >
...
> > ISC ERROR CODE:335544569
> >
> > ISC ERROR MESSAGE:
> > Dynamic SQL Error
> > SQL error code = -104
> > Token unknown - line 4, char 6
> > ,
> > ----------------
...
> >
> > What is wrong here?
>
> There is very likely a bug in my parsing of the query statement. I
recently
> had to make some changes looking for the FIRST/SKIP tokens and I could
have
> messed something up.
>

Hi, Jason,

I already found the problem. This is it:

if AnsiUpperCase( tmpStr ) = 'SELECT *' then
SQLSelectTxt := 'SELECT ' + SysKeyRelation + '.*';
tmpStr := Trim( SQLSelectTxt ) +
#13#10' , ' + SysKeyRelation +
'.' + IB_RDB + IB_DB_KEY;

when there is no promary key you add DB_KEY but in this partical
case there are #13#10 before * so AnsiUpperCase( tmpStr ) = 'SELECT *' is
false
thats why if he removes the ENTER it works. So the easy work around would be
to put * on the same line with SELECT.

I'll fix it tonight.

Ciao,



Best regards,
Application Developer
Calin Iancu, Pirtea
S.C. SoftScape S.R.L.
pcalin@...