jnwangntu / php-sql-parser

Automatically exported from code.google.com/p/php-sql-parser
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Some table names are keywords. #34

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Use a query that uses "cache" as the table name.
2. Other keywords can cause the same issue.

What is the expected output? What do you see instead?

The parse array uses "CACHE" keyword and does not parse the correct table part 
of the query. Completely changes the parse tree.

What version of the product are you using? On what operating system?

PHP 5.3 on MAMP 2.0 install.

Is this something that can be fixed?

Original issue reported on code.google.com by preston....@gmail.com on 2 Mar 2012 at 6:49

GoogleCodeExporter commented 8 years ago
This is the same problem as issue 31 and 32. I'll see what I can do.

Original comment by pho...@gmx.de on 2 Mar 2012 at 7:49

GoogleCodeExporter commented 8 years ago
I have fixed the problem with CACHE. As you have said, the parser has a problem 
with other keywords too. It is the nature of the parser, because it doesn't use 
a grammar to check the structure of the statements. The parser uses only the 
keywords to split the statements and that's the point which prevents the 
"wrong" usage of keywords with the parser.

Try the current version on 
https://www.phosco.info/publicsvn/php-sql-parser/tags/20120304

Original comment by pho...@gmx.de on 4 Mar 2012 at 10:24

GoogleCodeExporter commented 8 years ago
There is a test case for the issue, check out the current version on 
Google.Code.

Original comment by pho...@gmx.de on 13 Mar 2012 at 12:12