Skip to content
Merged
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
add casting to string for postgresql query builder
Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 committed Mar 14, 2019
commit bfd539017fa335d38ed7288b1616e8578ee82791
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,14 @@ class PgSqlExpressionBuilder extends ExpressionBuilder {
* @return string
*/
public function castColumn($column, $type) {
if ($type === IQueryBuilder::PARAM_INT) {
$column = $this->helper->quoteColumnName($column);
return new QueryFunction('CAST(' . $column . ' AS INT)');
switch ($type) {
case IQueryBuilder::PARAM_INT:
return new QueryFunction('CAST(' . $this->helper->quoteColumnName($column) . ' AS INT)');
case IQueryBuilder::PARAM_STR:
return new QueryFunction('CAST(' . $this->helper->quoteColumnName($column) . ' AS TEXT)');
default:
return parent::castColumn($column, $type);
}

return parent::castColumn($column, $type);
}

/**
Expand Down