xiaoyao-work / php-sql-parser

A pure PHP SQL (non validating) parser w/ focus on MySQL dialect of SQL
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

use of stringfunction in join condition of select statement results in error #124

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
1. define statement "SELECT t1.c1, t2.c2 FROM t1 LEFT JOIN t2 ON (LEFT(t1.c2,6) 
= t2.c1)"

2. Subsequent parse and create will result in fatal error :
 "Uncaught exception 'UnableToCreateSQLException' with message 'unknown [expr_type] = function in "expression ref_clause" [0] ' in D:\ontwikkeling\www\SqlParser\src\builders\RefClauseBuilder.php on line 85"

What is the expected output? What do you see instead?
expected :
SELECT t1.c1, t2.c2 FROM t1 LEFT JOIN t2 ON (LEFT(t1.c2,6) = t2.c1)

What version of the product are you using? On what operating system?
version : 
I checked out the version after r1080.
OS : Windows XP

Please provide any additional information below.
Same result with substring function.
Without function it runs fine :
"SELECT t1.c1, t2.c2 FROM t1 LEFT JOIN t2 ON (t1.c2 = t2.c1)"

Original issue reported on code.google.com by Henk.Blo...@gmail.com on 21 Feb 2014 at 1:42

GoogleCodeExporter commented 9 years ago
This seems to be a little extension, the Creator class doesn't know functions 
within the RefClause. I'll try to fix that this evening.

Original comment by pho...@gmx.de on 21 Feb 2014 at 3:52

GoogleCodeExporter commented 9 years ago
I have fixed the issue in r1086.

Original comment by pho...@gmx.de on 22 Feb 2014 at 7:29

GoogleCodeExporter commented 9 years ago
Hi,
thanks a lot!
You guys are good & fast.
Regards,
Henk

Original comment by Henk.Blo...@gmail.com on 22 Feb 2014 at 9:02

GoogleCodeExporter commented 9 years ago
Thanks, some issues are really simple to solve, other need a lot of time (i.e. 
issue 33) ...

Original comment by pho...@gmx.de on 24 Feb 2014 at 10:18