add count() as shortcut for count('*') in FunctionBuilder
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
0e9feeb090
commit
ac209cea52
|
@ -72,9 +72,10 @@ class FunctionBuilder implements IFunctionBuilder {
|
||||||
return new QueryFunction($this->helper->quoteColumnName($x) . ' - ' . $this->helper->quoteColumnName($y));
|
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)) : '';
|
$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) {
|
public function max($field) {
|
||||||
|
|
|
@ -104,7 +104,7 @@ interface IFunctionBuilder {
|
||||||
* @return IQueryFunction
|
* @return IQueryFunction
|
||||||
* @since 14.0.0
|
* @since 14.0.0
|
||||||
*/
|
*/
|
||||||
public function count($count, $alias = '');
|
public function count($count = '', $alias = '');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Takes the maximum of all rows in a column
|
* Takes the maximum of all rows in a column
|
||||||
|
|
Loading…
Reference in New Issue