From 837590d58d5546b1144e2a6bc68d0b4acf498071 Mon Sep 17 00:00:00 2001 From: provokateurin Date: Thu, 26 Sep 2024 08:57:06 +0200 Subject: [PATCH] fix(QueryBuilder): Restrict identifier length to 30 characters due to Oracle limitations Signed-off-by: provokateurin --- lib/private/DB/QueryBuilder/QueryBuilder.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/private/DB/QueryBuilder/QueryBuilder.php b/lib/private/DB/QueryBuilder/QueryBuilder.php index d78cf50e319..baf1b0fd341 100644 --- a/lib/private/DB/QueryBuilder/QueryBuilder.php +++ b/lib/private/DB/QueryBuilder/QueryBuilder.php @@ -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) { -- 2.39.5