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

Infinite loop when aliasing a table "as event" #71

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. execute this code :

$parser = new PHPSQLParser();
$sql = "select * from table1 as event;";
$parser->parse($sql);

2. Script enters an inifinite loop (throwing this notices):

PHP Notice:  Undefined offset: 78 in php-sql-parser.php.2 on line 1215
PHP Notice:  Undefined offset: 78 in php-sql-parser.php.2 on line 1216
...

What is the expected output? What do you see instead?
Expected the parser to return an array

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

Please provide any additional information below.

Original issue reported on code.google.com by marisr...@gmail.com on 17 Aug 2012 at 12:58

GoogleCodeExporter commented 8 years ago
The problem occurs, because EVENT is a keyword and produces its own section 
within the output. See REV 302, which fix that specific problem, other keywords 
can run into the same problem.

Original comment by pho...@gmx.de on 17 Aug 2012 at 1:55

GoogleCodeExporter commented 8 years ago
Tested in r302, works as expected.

Thank you

Original comment by marisr...@gmail.com on 17 Aug 2012 at 2:05

GoogleCodeExporter commented 8 years ago
I have changed the handling again, the parser now interprets EVENT as keyword 
after CREATE, DROP or ALTER only. So it should handle EVENT also within 
WHERE/SELECT/ORDER/GROUP correctly now.

Original comment by pho...@gmx.de on 17 Aug 2012 at 2:11

GoogleCodeExporter commented 8 years ago

Original comment by pho...@gmx.de on 17 Aug 2012 at 8:43

GoogleCodeExporter commented 8 years ago
Attached patch and tests for aliasing with keyword 'data'.

Original comment by marisr...@gmail.com on 20 Aug 2012 at 7:49

Attachments:

GoogleCodeExporter commented 8 years ago

Original comment by marisr...@gmail.com on 20 Aug 2012 at 7:51

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks for the patch, I have added it into r306.

Original comment by pho...@gmx.de on 20 Aug 2012 at 9:21