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

Error in creator => Fix included #57

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Parse the following query:

SELECT a.*, SUM(b.home) AS home,b.language,l.image,l.sef,l.title_native
FROM iuz6l_menu_types AS a
LEFT JOIN iuz6l_menu AS b ON b.menutype = a.menutype AND b.home != 0
LEFT JOIN iuz6l_languages AS l ON l.lang_code = language
WHERE (b.client_id = 0 OR b.client_id IS NULL)
GROUP BY a.id, a.menutype, a.description, a.title, 
b.menutype,b.language,l.image,l.sef,l.title_native

2. hand it over to the creator and voila it fails (php-sql-parser-20120507)

The problem lies in the "processRefClause" of the creator. It couldn't handle 
the " AND b.home != 0" after the JOIN.

FIX:

Adding:

$sql .= $this->processConstant($v);

under 

$sql .= $this->processOperator($v);  ## Line 408

fixes the problem :)

Original issue reported on code.google.com by fr...@frankmayer.net on 8 May 2012 at 12:49

GoogleCodeExporter commented 8 years ago
Thank you for the fix, I have added it to REV 273. I like small functions where 
you can add a simple line and all is fine :-)

Original comment by pho...@gmx.de on 8 May 2012 at 2:34

GoogleCodeExporter commented 8 years ago
Thank you for your work on this. I wish all bugs were that easy to fix ;)

Original comment by fr...@frankmayer.net on 8 May 2012 at 5:12