Some SQL queries do not have a table / from clause. The parser works fine, the
creator assumes the FROM clause will always be present.
$parser = new PHPSQLParser;
$parsed = $parser->parse('SELECT NOW()');
$creator = new PHPSQLCreator();
print $creator->create($parsed);
What is the expected output? What do you see instead?
Expected "SELECT NOW()", Got undefined index 'FROM'
Simple fix to change processSelectStatement:71
from:
$sql = $this->processSELECT($parsed['SELECT']) . " " .
$this->processFROM($parsed['FROM']);
to:
$sql = $this->processSELECT($parsed['SELECT']);
if (isset($parsed['FROM'])) {
$sql .= " " . $this->processFROM($parsed['FROM']);
}
Original issue reported on code.google.com by cag...@gmail.com on 12 Dec 2012 at 12:22
Original issue reported on code.google.com by
cag...@gmail.com
on 12 Dec 2012 at 12:22