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

Problem parsing group by alias #118

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
To reproduce:
$sql = "select organism_name as reference from organisms group by reference";
$parser = new PHPSQLParser();
$creator = new PHPSQLCreator();
$tree = $parser->parse($sql);
var_dump($creator->create($tree));

The last line causes this exception:
PHP Warning:  Uncaught exception 'UnableToCreateSQLException' with message 
'unknown [expr_type] = alias in "GROUP" [0] ' in 
/home/george/Projects/svn/php-sql-parser-read-only/src/builders/GroupByBuilder.p
hp:82
Stack trace:
#0 
/home/george/Projects/svn/php-sql-parser-read-only/src/builders/SelectStatementB
uilder.php(77): GroupByBuilder->build(Array)
#1 
/home/george/Projects/svn/php-sql-parser-read-only/src/builders/SelectStatementB
uilder.php(104): SelectStatementBuilder->buildGROUP(Array)
#2 
/home/george/Projects/svn/php-sql-parser-read-only/src/PHPSQLCreator.php(75): 
SelectStatementBuilder->build(Array)
#3 php shell code(1): PHPSQLCreator->create(Array)
#4 {main}
  thrown in /home/george/Projects/svn/php-sql-parser-read-only/src/builders/GroupByBuilder.php on line 82

Thanks,
-George

Original issue reported on code.google.com by noisecap...@gmail.com on 29 Jan 2014 at 6:31

GoogleCodeExporter commented 8 years ago
The issue has been fixed, see r1055

Original comment by pho...@gmx.de on 30 Jan 2014 at 10:29

GoogleCodeExporter commented 8 years ago
I can confirm this, thanks for your efforts!

Original comment by noisecap...@gmail.com on 30 Jan 2014 at 4:20