diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/DB/QueryBuilder/FunctionBuilder/FunctionBuilder.php | 5 | ||||
-rw-r--r-- | lib/public/DB/QueryBuilder/IFunctionBuilder.php | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/lib/private/DB/QueryBuilder/FunctionBuilder/FunctionBuilder.php b/lib/private/DB/QueryBuilder/FunctionBuilder/FunctionBuilder.php index 3b67661c8b0..46bb536dfd2 100644 --- a/lib/private/DB/QueryBuilder/FunctionBuilder/FunctionBuilder.php +++ b/lib/private/DB/QueryBuilder/FunctionBuilder/FunctionBuilder.php @@ -72,9 +72,10 @@ class FunctionBuilder implements IFunctionBuilder { return new QueryFunction($this->helper->quoteColumnName($x) . ' - ' . $this->helper->quoteColumnName($y)); } - public function count($count, $alias = '') { + public function count($count = '', $alias = '') { $alias = $alias ? (' AS ' . $this->helper->quoteColumnName($alias)) : ''; - return new QueryFunction('COUNT(' . $this->helper->quoteColumnName($count) . ')' . $alias); + $quotedName = $count === '' ? '*' : $this->helper->quoteColumnName($count); + return new QueryFunction('COUNT(' . $quotedName . ')' . $alias); } public function max($field) { diff --git a/lib/public/DB/QueryBuilder/IFunctionBuilder.php b/lib/public/DB/QueryBuilder/IFunctionBuilder.php index 066be470150..861a576914a 100644 --- a/lib/public/DB/QueryBuilder/IFunctionBuilder.php +++ b/lib/public/DB/QueryBuilder/IFunctionBuilder.php @@ -104,7 +104,7 @@ interface IFunctionBuilder { * @return IQueryFunction * @since 14.0.0 */ - public function count($count, $alias = ''); + public function count($count = '', $alias = ''); /** * Takes the maximum of all rows in a column |