Board index » delphi » SELECT gives "invalid use of keyword"

SELECT gives "invalid use of keyword"

I'm having a little trouble with a table called "user".  It is the
privileges table in MySQL that I am accessing through MyODBC.
Everything works good except "user" is some kind of key word.

SELECT * FROM user    (Works OK...  with RequestLive False)
SELECT * FROM user    (gives "Invalid use of keyword Token User... with
RequestLive True)

This seems a little weird to me.  Why is "user" a keyword?  And why is
it only recognized as a key word if RequestLive:=True?  Is there
a work-around short of renaming the table?

Thanks,
Scott Serr

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.

 

Re:SELECT gives "invalid use of keyword"


When you have RequestLive set to false, the BDE just passes the query
through without any checks and balances. If you set it to true, the BDE
checks the query statement for compliance. This is probably what is
happening, proving the old adege that you should NEVER use any key words for
table or field names.

Woody

Quote
<ser...@my-deja.com> wrote in message news:7nhtvh$hj9$1@nnrp1.deja.com...

> I'm having a little trouble with a table called "user".  It is the
> privileges table in MySQL that I am accessing through MyODBC.
> Everything works good except "user" is some kind of key word.

> SELECT * FROM user    (Works OK...  with RequestLive False)
> SELECT * FROM user    (gives "Invalid use of keyword Token User... with
> RequestLive True)

> This seems a little weird to me.  Why is "user" a keyword?  And why is
> it only recognized as a key word if RequestLive:=True?  Is there
> a work-around short of renaming the table?

> Thanks,
> Scott Serr

> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.

Re:SELECT gives "invalid use of keyword"


Try Select * from "User.db"

replace the extention as nessisary.

Re:SELECT gives "invalid use of keyword"


You _might_ get around this by enclosing USER in quotation marks. If that
does not work try posting your question in the database.sql newsgroup where
client/server questions are handled.

Bill

--

Bill Todd - TeamB
(TeamB cannot respond to questions received via email)

Re:SELECT gives "invalid use of keyword"


Quote
>I'm having a little trouble with a table called "user".  It is the
>privileges table in MySQL that I am accessing through MyODBC.
>Everything works good except "user" is some kind of key word.

>SELECT * FROM user    (Works OK...  with RequestLive False)
>SELECT * FROM user    (gives "Invalid use of keyword Token User... with
>RequestLive True)

>This seems a little weird to me.  Why is "user" a keyword?
yes
> And why is it only recognized as a key word if RequestLive:=True?  

Because in a live query BDE parses the query for validity with Local SQL.
when the query is not live it is a straight pass through

Quote
>Is there a work-around short of renaming the table?

Quotes should do it
SELECT * FROM "user"

--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Other Threads