add casting to string for postgresql query builder

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2019-03-14 14:19:10 +01:00
parent 762a8bb3d9
commit bfd539017f
No known key found for this signature in database
GPG Key ID: 42B69D8A64526EFB
1 changed files with 7 additions and 5 deletions

View File

@ -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);
}
/**