rickywu-posh / 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

LIMIT x, y / LIMIT y OFFSET x parsed inconsistently ? #53

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. parse query:
SELECT * FROM table WHERE a=1 ORDER BY c DESC LIMIT 10 OFFSET 20
2. Notice Limit result:
[LIMIT] => Array
        (
            [start] => 
            [end] => 10 OFFSET 20
        )

3. SELECT * FROM table WHERE a=1 ORDER BY c DESC LIMIT 20, 10

4. 
[LIMIT] => Array
        (
            [start] => 20
            [end] => 10
        )

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

Since both queries are equivalent, they should probably render the values the 
same way (or in a very similar way. Access to "start" and "end" should yield 
same results). Also, is using "start" and "end" really the right terminology ? 
should it be offset, count ?

What version of the product are you using? On what operating system?
PHP 5.3.10, Ubuntu linux 12.04,

Please provide any additional information below.

Original issue reported on code.google.com by akay...@gmail.com on 4 May 2012 at 6:36

GoogleCodeExporter commented 8 years ago
The LIMIT clause doesn't accept the keyword OFFSET at the moment. It awaits 
only a comma between the two numbers. I have to extend the parser in this point.

Original comment by pho...@gmx.de on 7 May 2012 at 7:47

GoogleCodeExporter commented 8 years ago
Check out REV 263, it contains a fix and a test case for this issue.

Original comment by pho...@gmx.de on 7 May 2012 at 9:44