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

alisases issue #98

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I found an issue with using aliases that have a . or space in them, this line
~505 in php-sql-creator.php
[code] $sql .= " " . $parsed['alias']['name']; [/code] 
in processAlias method should be:
[code] $sql .= " `" . $parsed['alias']['name']."` "; [/code]

then anything can be used for an alias

Original issue reported on code.google.com by i...@theorganicagency.com on 25 Oct 2013 at 10:09

GoogleCodeExporter commented 8 years ago
I think, this could be better solved within the parser.

Original comment by pho...@gmx.de on 1 Nov 2013 at 3:55

GoogleCodeExporter commented 8 years ago
I'm not sure if it's really a parser problem, it's more that the alias should 
always be contained within backticks

Original comment by i...@theorganicagency.com on 1 Nov 2013 at 4:18

GoogleCodeExporter commented 8 years ago
I try to generate SQL with the Creator, which is as close as possible to the 
original SQL statement, which the parser splits. The alias hasn't always 
backticks, so I think, the parser should keep the backticks, but shouldn't add 
one. If I keep the backticks, there are some side-effects (i.e. with the order 
clause). Maybe I could add another property like "quoted" or something. The 
creator could generate backticks only for quoted==true.

Original comment by pho...@gmx.de on 1 Nov 2013 at 6:26

GoogleCodeExporter commented 8 years ago

Original comment by pho...@gmx.de on 5 Nov 2013 at 8:49

GoogleCodeExporter commented 8 years ago
I have fixed your issue, see r433.

Original comment by pho...@gmx.de on 5 Nov 2013 at 4:18