Browse Source
Merge pull request #14683 from nextcloud/postgres-cast-string
add casting to string for postgresql query builder
pull/14702/head
Morris Jobke
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
7 additions and
5 deletions
-
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); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
|