summaryrefslogtreecommitdiffstats
path: root/lib/private/DB
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-11-12 17:43:56 +0100
committerGitHub <noreply@github.com>2018-11-12 17:43:56 +0100
commitfd8eeccb15e1219a2d18fc421e741c315737c55e (patch)
tree55b56592cf40ab4fcc605e45a95d13d79806eb91 /lib/private/DB
parent9e1ec0cf46055dbf08a139124d292eb38b8aebd2 (diff)
parentbb352fb667e87ea0829f1da5f9e85c34bdefe9fa (diff)
downloadnextcloud-server-fd8eeccb15e1219a2d18fc421e741c315737c55e.tar.gz
nextcloud-server-fd8eeccb15e1219a2d18fc421e741c315737c55e.zip
Merge pull request #11942 from nextcloud/techdebt/noid/use-count-function
Use the defined func()->count() instead of manual counting
Diffstat (limited to 'lib/private/DB')
-rw-r--r--lib/private/DB/QueryBuilder/FunctionBuilder/FunctionBuilder.php5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/private/DB/QueryBuilder/FunctionBuilder/FunctionBuilder.php b/lib/private/DB/QueryBuilder/FunctionBuilder/FunctionBuilder.php
index cf6183b0238..a9d2f6f9a35 100644
--- a/lib/private/DB/QueryBuilder/FunctionBuilder/FunctionBuilder.php
+++ b/lib/private/DB/QueryBuilder/FunctionBuilder/FunctionBuilder.php
@@ -72,7 +72,8 @@ class FunctionBuilder implements IFunctionBuilder {
return new QueryFunction($this->helper->quoteColumnName($x) . ' - ' . $this->helper->quoteColumnName($y));
}
- public function count($input) {
- return new QueryFunction('COUNT(' . $this->helper->quoteColumnName($input) . ')');
+ public function count($count, $alias = '') {
+ $alias = $alias ? (' AS ' . $this->helper->quoteColumnName($alias)) : '';
+ return new QueryFunction('COUNT(' . $this->helper->quoteColumnName($count) . ')' . $alias);
}
}