From ac45af68cd7d30bb202e6b39ecf5bfcfd4b00225 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 12 Apr 2017 16:09:35 +0200 Subject: Add sub() to the query function builder Signed-off-by: Robin Appelman --- lib/private/DB/QueryBuilder/FunctionBuilder/FunctionBuilder.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/private/DB/QueryBuilder') diff --git a/lib/private/DB/QueryBuilder/FunctionBuilder/FunctionBuilder.php b/lib/private/DB/QueryBuilder/FunctionBuilder/FunctionBuilder.php index 6bd98e4ce50..9ec8a9fd3c4 100644 --- a/lib/private/DB/QueryBuilder/FunctionBuilder/FunctionBuilder.php +++ b/lib/private/DB/QueryBuilder/FunctionBuilder/FunctionBuilder.php @@ -53,4 +53,8 @@ class FunctionBuilder implements IFunctionBuilder { return new QueryFunction('SUBSTR(' . $this->helper->quoteColumnName($input) . ', ' . $this->helper->quoteColumnName($start) . ')'); } } + + public function sum($field) { + return new QueryFunction('SUM(' . $this->helper->quoteColumnName($field) . ')'); + } } -- cgit v1.2.3