summaryrefslogtreecommitdiffstats
path: root/lib/private/DB/QueryBuilder
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2017-04-12 16:09:35 +0200
committerRobin Appelman <robin@icewind.nl>2017-04-12 16:09:35 +0200
commitac45af68cd7d30bb202e6b39ecf5bfcfd4b00225 (patch)
treedb8e9c2672513ccd4ac9c4437b2dfb088b7d8073 /lib/private/DB/QueryBuilder
parent18580395d4095842462e035a2d947e716413d2fd (diff)
downloadnextcloud-server-ac45af68cd7d30bb202e6b39ecf5bfcfd4b00225.tar.gz
nextcloud-server-ac45af68cd7d30bb202e6b39ecf5bfcfd4b00225.zip
Add sub() to the query function builder
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/DB/QueryBuilder')
-rw-r--r--lib/private/DB/QueryBuilder/FunctionBuilder/FunctionBuilder.php4
1 files changed, 4 insertions, 0 deletions
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) . ')');
+ }
}