Open kannan84 opened 7 years ago
I got a very similar error - did you follow up on this? Did you find a solution? Thank you!
in SubTreeBuilder.php is missing the protected function buildInList() so add the following method in it
protected function buildInList($parsed) {
$builder = new InListBuilder();
return $builder->build($parsed);
}
Found an issue with PHPSQLCreator when using in-list expression in expression's subtree.
$sql="SELECT name,IF(player_type IN ('National','International'), 'Recognized', 'Unrecognized') AS 'Status' from players"; $parser = new PHPSQLParser($sql, true); print_r($parser->parsed); $creator = new PHPSQLCreator($parser->parsed); echo $creator->created;
While Parsing we got the following array for the second column,
Array ( [expr_type] => function [alias] => Array ( [as] => 1 [name] => 'Status' [base_expr] => AS 'Status' [no_quotes] => Array ( [delim] => [parts] => Array ( [0] => Status )
PHPSQLCreator throws the following exception while trying to build from this array element,
exception 'PHPSQLParser\exceptions\UnableToCreateSQLException' with message 'unknown [expr_type] = in-list in "expression subtree" [2] '