diff options
author | Robin Appelman <robin@icewind.nl> | 2019-03-14 14:19:10 +0100 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2019-03-14 14:19:10 +0100 |
commit | bfd539017fa335d38ed7288b1616e8578ee82791 (patch) | |
tree | 9deca3cd81101f1299744f29276ee89456bf6053 /lib | |
parent | 762a8bb3d9521a9f75d9e186150cb77241b3bc19 (diff) | |
download | nextcloud-server-bfd539017fa335d38ed7288b1616e8578ee82791.tar.gz nextcloud-server-bfd539017fa335d38ed7288b1616e8578ee82791.zip |
add casting to string for postgresql query builder
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/DB/QueryBuilder/ExpressionBuilder/PgSqlExpressionBuilder.php | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/private/DB/QueryBuilder/ExpressionBuilder/PgSqlExpressionBuilder.php b/lib/private/DB/QueryBuilder/ExpressionBuilder/PgSqlExpressionBuilder.php index bd18b38c52e..1b0e081024b 100644 --- a/lib/private/DB/QueryBuilder/ExpressionBuilder/PgSqlExpressionBuilder.php +++ b/lib/private/DB/QueryBuilder/ExpressionBuilder/PgSqlExpressionBuilder.php @@ -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); } /** |