aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/DB
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2022-03-28 00:01:17 +0200
committerCôme Chilliet <come.chilliet@nextcloud.com>2022-03-28 00:01:17 +0200
commit7407a324d94afa7009a4efa3a8fbe71734e6ea85 (patch)
tree375b2e5348939eb40e2d24084e32418f92d9fabb /lib/private/DB
parent25af856ed26d0a4ef542b9d621b5e3512198ad99 (diff)
downloadnextcloud-server-7407a324d94afa7009a4efa3a8fbe71734e6ea85.tar.gz
nextcloud-server-7407a324d94afa7009a4efa3a8fbe71734e6ea85.zip
Fix LENGTH function name across databases
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'lib/private/DB')
-rw-r--r--lib/private/DB/QueryBuilder/FunctionBuilder/FunctionBuilder.php2
-rw-r--r--lib/private/DB/QueryBuilder/FunctionBuilder/OCIFunctionBuilder.php6
-rw-r--r--lib/private/DB/QueryBuilder/FunctionBuilder/SqliteFunctionBuilder.php6
3 files changed, 13 insertions, 1 deletions
diff --git a/lib/private/DB/QueryBuilder/FunctionBuilder/FunctionBuilder.php b/lib/private/DB/QueryBuilder/FunctionBuilder/FunctionBuilder.php
index e121374a763..e0a7549a0ad 100644
--- a/lib/private/DB/QueryBuilder/FunctionBuilder/FunctionBuilder.php
+++ b/lib/private/DB/QueryBuilder/FunctionBuilder/FunctionBuilder.php
@@ -103,7 +103,7 @@ class FunctionBuilder implements IFunctionBuilder {
public function charLength($field, $alias = ''): IQueryFunction {
$alias = $alias ? (' AS ' . $this->helper->quoteColumnName($alias)) : '';
$quotedName = $this->helper->quoteColumnName($field);
- return new QueryFunction('LENGTH(' . $quotedName . ')' . $alias);
+ return new QueryFunction('CHAR_LENGTH(' . $quotedName . ')' . $alias);
}
public function max($field): IQueryFunction {
diff --git a/lib/private/DB/QueryBuilder/FunctionBuilder/OCIFunctionBuilder.php b/lib/private/DB/QueryBuilder/FunctionBuilder/OCIFunctionBuilder.php
index 1a9eae3c21f..a9844ec3373 100644
--- a/lib/private/DB/QueryBuilder/FunctionBuilder/OCIFunctionBuilder.php
+++ b/lib/private/DB/QueryBuilder/FunctionBuilder/OCIFunctionBuilder.php
@@ -97,4 +97,10 @@ class OCIFunctionBuilder extends FunctionBuilder {
$quotedName = $this->helper->quoteColumnName($field);
return new QueryFunction('LENGTHB(' . $quotedName . ')' . $alias);
}
+
+ public function charLength($field, $alias = ''): IQueryFunction {
+ $alias = $alias ? (' AS ' . $this->helper->quoteColumnName($alias)) : '';
+ $quotedName = $this->helper->quoteColumnName($field);
+ return new QueryFunction('LENGTH(' . $quotedName . ')' . $alias);
+ }
}
diff --git a/lib/private/DB/QueryBuilder/FunctionBuilder/SqliteFunctionBuilder.php b/lib/private/DB/QueryBuilder/FunctionBuilder/SqliteFunctionBuilder.php
index 4e9e83a49d2..bb97d2e29f9 100644
--- a/lib/private/DB/QueryBuilder/FunctionBuilder/SqliteFunctionBuilder.php
+++ b/lib/private/DB/QueryBuilder/FunctionBuilder/SqliteFunctionBuilder.php
@@ -54,4 +54,10 @@ class SqliteFunctionBuilder extends FunctionBuilder {
$quotedName = $this->helper->quoteColumnName($field);
return new QueryFunction('LENGTH(CAST(' . $quotedName . ' as BLOB))' . $alias);
}
+
+ public function charLength($field, $alias = ''): IQueryFunction {
+ $alias = $alias ? (' AS ' . $this->helper->quoteColumnName($alias)) : '';
+ $quotedName = $this->helper->quoteColumnName($field);
+ return new QueryFunction('LENGTH(' . $quotedName . ')' . $alias);
+ }
}