mnpenner / 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

parser throws fatal error for SET SESSION group_concat_max_len = @@max_allowed_packet #67

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
The following SQL is currently not supported by the parser:
SET SESSION group_concat_max_len = @@max_allowed_packet

What is the expected output? What do you see instead?
We get
Fatal error: Uncaught exception 'UnableToCalculatePositionException' with 
message 'cannot calculate position of @ within @@max_allowed_packet' in 
/home/wwwadmin/baseUpdate/php-sql-parser/php-sql-parser.php:2023

What version of the product are you using? On what operating system?
The newest version downloaded today (23.7.2012) on Debian.

Please provide any additional information below.
I assume, there is no additional information required.

Original issue reported on code.google.com by i...@enterprise-technologies.de on 23 Jul 2012 at 1:27

GoogleCodeExporter commented 9 years ago
This problem has several levels. First, the result array of the parser is 
wrong, it contains too many colrefs. Second, an @ character after an operator 
is not allowed.

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

GoogleCodeExporter commented 9 years ago
The exact same error (with SVN revision 297) is raised on a valid expression 
like:

SET @a = 1;

The lexer will split this into '@', 'a' however I would expect something like 
'@a'. A quick fix was to remove the '@' in php-sql-parser.php:183 (class 
LexerSplitter.$splitters). 

But most probably I cannot see the place where this breaks other SQL 
expressions...

Original comment by adrian.p...@googlemail.com on 15 Aug 2012 at 12:27

GoogleCodeExporter commented 9 years ago
Issue 72 has been merged into this issue.

Original comment by pho...@gmx.de on 20 Aug 2012 at 7:59

GoogleCodeExporter commented 9 years ago
Check out r308, it solves some problems with user-defined variables.

Original comment by pho...@gmx.de on 20 Aug 2012 at 10:11

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
There is still a problem with SET SESSION, the second keyword is recognized as 
colref. The SET statement is actually not supported by the parser, but I'll 
open an enhancement request for that.

Original comment by pho...@gmx.de on 20 Aug 2012 at 10:15

GoogleCodeExporter commented 9 years ago

Original comment by pho...@gmx.de on 22 Aug 2012 at 6:39

GoogleCodeExporter commented 9 years ago
r319 contains now a patch, which handles the SET statement correctly. Please 
check it with some real life samples.

Original comment by pho...@gmx.de on 22 Aug 2012 at 7:05

GoogleCodeExporter commented 9 years ago
No response from user.

Original comment by pho...@gmx.de on 24 Aug 2012 at 9:56

GoogleCodeExporter commented 9 years ago
Oh, come on, give the user some days to check :-)

Our tests are running fine now, no uncaught exception any more.
Even @@ is parsed corrctly.

Very nice. #67 can be closed imho.

Thanks a lot!

Original comment by i...@enterprise-technologies.de on 25 Aug 2012 at 1:59

GoogleCodeExporter commented 9 years ago
I hate long issue lists, so I try to close issues as fast as possible after I 
have published a patch :-) 

It won't happen again, from now on I'm a reformed character (LOL).

Original comment by pho...@gmx.de on 27 Aug 2012 at 7:23