aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJoas Schilling <213943+nickvergessen@users.noreply.github.com>2020-12-14 14:31:15 +0100
committerGitHub <noreply@github.com>2020-12-14 14:31:15 +0100
commit39bee7948d44c2f5d6f5465bc9c4c3ffe6b8c34e (patch)
treeddf496f2e87f5c4d8e49b389634bbd9576c0d8e0 /lib
parent8f4c95f2317f335f28214322a86efc9c33dec220 (diff)
parent5828f3c4f91c07e4e2b1967db72516721c484014 (diff)
downloadnextcloud-server-39bee7948d44c2f5d6f5465bc9c4c3ffe6b8c34e.tar.gz
nextcloud-server-39bee7948d44c2f5d6f5465bc9c4c3ffe6b8c34e.zip
Merge pull request #24631 from nextcloud/bugfix/noid/prevent-select-asterix-and-specifics
Prevent * and other things in the same query for Oracle
Diffstat (limited to 'lib')
-rw-r--r--lib/private/DB/QueryBuilder/QueryBuilder.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/private/DB/QueryBuilder/QueryBuilder.php b/lib/private/DB/QueryBuilder/QueryBuilder.php
index ebd715df1c1..a5ea08127c7 100644
--- a/lib/private/DB/QueryBuilder/QueryBuilder.php
+++ b/lib/private/DB/QueryBuilder/QueryBuilder.php
@@ -31,6 +31,7 @@ namespace OC\DB\QueryBuilder;
use Doctrine\DBAL\Platforms\MySqlPlatform;
use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
+use Doctrine\DBAL\Query\QueryException;
use OC\DB\OracleConnection;
use OC\DB\QueryBuilder\ExpressionBuilder\ExpressionBuilder;
use OC\DB\QueryBuilder\ExpressionBuilder\MySqlExpressionBuilder;
@@ -223,6 +224,26 @@ class QueryBuilder implements IQueryBuilder {
}
}
+ if (!empty($this->getQueryPart('select'))) {
+ $select = $this->getQueryPart('select');
+ $hasSelectAll = array_filter($select, static function ($s) {
+ return $s === '*';
+ });
+ $hasSelectSpecific = array_filter($select, static function ($s) {
+ return $s !== '*';
+ });
+
+ if (empty($hasSelectAll) === empty($hasSelectSpecific)) {
+ $exception = new QueryException('Query is selecting * and specific values in the same query. This is not supported in Oracle.');
+ $this->logger->logException($exception, [
+ 'message' => 'Query is selecting * and specific values in the same query. This is not supported in Oracle.',
+ 'query' => $this->getSQL(),
+ 'level' => ILogger::ERROR,
+ 'app' => 'core',
+ ]);
+ }
+ }
+
return $this->queryBuilder->execute();
}