]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(QueryBuilder): Restrict identifier length to 30 characters due to Oracle limitations backport/48361/stable28 48389/head
authorprovokateurin <kate@provokateurin.de>
Thu, 26 Sep 2024 06:57:06 +0000 (08:57 +0200)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Thu, 26 Sep 2024 13:13:04 +0000 (13:13 +0000)
Signed-off-by: provokateurin <kate@provokateurin.de>
lib/private/DB/QueryBuilder/QueryBuilder.php

index d78cf50e319e06af5207f518c64719bde7397e0b..baf1b0fd3417496c495e48fa8913315b0630e24d 100644 (file)
@@ -249,6 +249,23 @@ class QueryBuilder implements IQueryBuilder {
                        }
                }
 
+               $tooLongOutputColumns = [];
+               foreach ($this->getOutputColumns() as $column) {
+                       if (strlen($column) > 30) {
+                               $tooLongOutputColumns[] = $column;
+                       }
+               }
+
+               if (!empty($tooLongOutputColumns)) {
+                       $exception = new QueryException('More than 30 characters for an output column name are not allowed on Oracle.');
+                       $this->logger->error($exception->getMessage(), [
+                               'query' => $this->getSQL(),
+                               'columns' => $tooLongOutputColumns,
+                               'app' => 'core',
+                               'exception' => $exception,
+                       ]);
+               }
+
                $numberOfParameters = 0;
                $hasTooLargeArrayParameter = false;
                foreach ($this->getParameters() as $parameter) {