summaryrefslogtreecommitdiffstats
path: root/lib/private/DB
diff options
context:
space:
mode:
authorblizzz <blizzz@arthur-schiwon.de>2021-01-14 11:36:42 +0100
committerGitHub <noreply@github.com>2021-01-14 11:36:42 +0100
commitf9ab7575e70aeb5a08cba8fca9661dd6e4704cc9 (patch)
tree7c6cd135c3b6801108a3f518f085cb4ca4f4ef4b /lib/private/DB
parent121e2d832b198b01bf25d5f9c3a1b9acdf5cb1a8 (diff)
parent21ca5d4514eed69e40c26ddba0e3671923594e4e (diff)
downloadnextcloud-server-f9ab7575e70aeb5a08cba8fca9661dd6e4704cc9.tar.gz
nextcloud-server-f9ab7575e70aeb5a08cba8fca9661dd6e4704cc9.zip
Merge pull request #25036 from nextcloud/fix/noid/limitied-allowed-items-db-in_2
respect DB restrictions on number of arguments in statements and queries
Diffstat (limited to 'lib/private/DB')
-rw-r--r--lib/private/DB/QueryBuilder/QueryBuilder.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/private/DB/QueryBuilder/QueryBuilder.php b/lib/private/DB/QueryBuilder/QueryBuilder.php
index 657e52e54bc..fb28fa28649 100644
--- a/lib/private/DB/QueryBuilder/QueryBuilder.php
+++ b/lib/private/DB/QueryBuilder/QueryBuilder.php
@@ -253,6 +253,36 @@ class QueryBuilder implements IQueryBuilder {
}
}
+ $numberOfParameters = 0;
+ $hasTooLargeArrayParameter = false;
+ foreach ($this->getParameters() as $parameter) {
+ if (is_array($parameter)) {
+ $count = count($parameter);
+ $numberOfParameters += $count;
+ $hasTooLargeArrayParameter = $hasTooLargeArrayParameter || ($count > 1000);
+ }
+ }
+
+ if ($hasTooLargeArrayParameter) {
+ $exception = new QueryException('More than 1000 expressions in a list are not allowed on Oracle.');
+ $this->logger->logException($exception, [
+ 'message' => 'More than 1000 expressions in a list are not allowed on Oracle.',
+ 'query' => $this->getSQL(),
+ 'level' => ILogger::ERROR,
+ 'app' => 'core',
+ ]);
+ }
+
+ if ($numberOfParameters > 65535) {
+ $exception = new QueryException('The number of parameters must not exceed 65535. Restriction by PostgreSQL.');
+ $this->logger->logException($exception, [
+ 'message' => 'The number of parameters must not exceed 65535. Restriction by PostgreSQL.',
+ 'query' => $this->getSQL(),
+ 'level' => ILogger::ERROR,
+ 'app' => 'core',
+ ]);
+ }
+
$result = $this->queryBuilder->execute();
if (is_int($result)) {
return $result;