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

Floating point numbers fail parsing if no number added after "." #97

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Parsing of floating point numbers fails in the following legal query:

select webid, floor(iz/2.) as fl from MDR1.Tweb512 as w where w.webid < 100

but not in

select webid, floor(iz/2.0) as fl from MDR1.Tweb512 as w where w.webid < 100

Problem lies in lexer->concatColReferences where everything after a "." is 
considered part of a column reference.

Solution:

299: if ($this->endsWith($tokens[$i], '.') && !is_numeric($tokens[$i])) {

instead of

299: if ($this->endsWith($tokens[$i], '.')) {

Original issue reported on code.google.com by adrian.p...@googlemail.com on 3 Sep 2013 at 8:21

GoogleCodeExporter commented 8 years ago
I have added your code into the repository, good job! 
Thank you.

Original comment by pho...@gmx.de on 23 Oct 2013 at 8:49