Skip to content
Snippets Groups Projects
Unverified Commit 5828f3c4 authored by Joas Schilling's avatar Joas Schilling
Browse files

Prevent * and other things in the same query for Oracle

parent 5fc20e88
No related branches found
No related tags found
No related merge requests found
...@@ -31,6 +31,7 @@ namespace OC\DB\QueryBuilder; ...@@ -31,6 +31,7 @@ namespace OC\DB\QueryBuilder;
use Doctrine\DBAL\Platforms\MySqlPlatform; use Doctrine\DBAL\Platforms\MySqlPlatform;
use Doctrine\DBAL\Platforms\PostgreSqlPlatform; use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
use Doctrine\DBAL\Platforms\SqlitePlatform; use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Query\QueryException;
use OC\DB\OracleConnection; use OC\DB\OracleConnection;
use OC\DB\QueryBuilder\ExpressionBuilder\ExpressionBuilder; use OC\DB\QueryBuilder\ExpressionBuilder\ExpressionBuilder;
use OC\DB\QueryBuilder\ExpressionBuilder\MySqlExpressionBuilder; use OC\DB\QueryBuilder\ExpressionBuilder\MySqlExpressionBuilder;
...@@ -223,6 +224,26 @@ class QueryBuilder implements IQueryBuilder { ...@@ -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(); return $this->queryBuilder->execute();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment