Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/PHPSQL/Creator.php
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,8 @@ protected function processFunction($parsed) {
if ($len == strlen($sql)) {
throw new \PHPSQL\Exception\UnableToCreateSQL('function subtree', $k, $v, 'expr_type');
}

$sql .= ($this->isReserved($v) ? " " : ",");
$sql .= ($this->isReserved($v) || ($parsed['base_expr'] == 'CAST')
? " " : ",");
}
return $parsed['base_expr'] . "(" . substr($sql, 0, -1) . ")";
}
Expand Down Expand Up @@ -449,6 +449,8 @@ protected function processSubTree($parsed, $delim = " ") {
$sql .= $this->processConstant($v);
$sql .= $this->processSubQuery($v);
$sql .= $this->processSelectBracketExpression($v);
$sql .= $this->processReserved($v);
$sql .= $this->processColRef($v);

if ($len == strlen($sql)) {
throw new \PHPSQL\Exception\UnableToCreateSQL('expression subtree', $k, $v, 'expr_type');
Expand All @@ -470,6 +472,7 @@ protected function processRefClause($parsed) {
$sql .= $this->processColRef($v);
$sql .= $this->processOperator($v);
$sql .= $this->processConstant($v);
$sql .= $this->processFunction($v);

if ($len == strlen($sql)) {
throw new \PHPSQL\Exception\UnableToCreateSQL('expression ref_clause', $k, $v, 'expr_type');
Expand Down