Skip to content

Commit

Permalink
Mysql outputting setFunctionAsColumn wrong.
Browse files Browse the repository at this point in the history
  • Loading branch information
nilportugues committed Dec 2, 2015
1 parent 916376b commit 3dca30b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Builder/MySqlBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ public function writeColumnName(Column $column)
return '*';
}

if (false !== strpos($column->getName(), "(")) {
return parent::writeColumnName($column);
}

return $this->wrapper(parent::writeColumnName($column));
}

Expand Down Expand Up @@ -78,6 +82,10 @@ public function writeColumnAlias($alias)
*/
protected function wrapper($string, $char = '`')
{
if (0 === strlen($string)) {
return '';
}

return $char.$string.$char;
}
}

0 comments on commit 3dca30b

Please sign in to comment.