aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorKate <26026535+provokateurin@users.noreply.github.com>2024-10-03 15:48:10 +0200
committerGitHub <noreply@github.com>2024-10-03 15:48:10 +0200
commit8638a89fca62e3f7ed9fa387e9edb6db6a59baae (patch)
tree902b6b4a35fc7b6cc6ffe48e0290e8e92b11f17e /lib/private
parent9095b49592b66973a439126897ad2e5fed6f6436 (diff)
parente445be12028c0d33c0a7f0ed8693e3a67c0f999c (diff)
downloadnextcloud-server-8638a89fca62e3f7ed9fa387e9edb6db6a59baae.tar.gz
nextcloud-server-8638a89fca62e3f7ed9fa387e9edb6db6a59baae.zip
Merge pull request #48522 from nextcloud/fix/querybuilder/output-columns-aliases
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/DB/QueryBuilder/QueryBuilder.php12
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/private/DB/QueryBuilder/QueryBuilder.php b/lib/private/DB/QueryBuilder/QueryBuilder.php
index b42b380e3d0..56c860bc42c 100644
--- a/lib/private/DB/QueryBuilder/QueryBuilder.php
+++ b/lib/private/DB/QueryBuilder/QueryBuilder.php
@@ -582,6 +582,9 @@ class QueryBuilder implements IQueryBuilder {
if (is_array($column)) {
$this->addOutputColumns($column);
} elseif (is_string($column) && !str_contains($column, '*')) {
+ if (str_contains(strtolower($column), ' as ')) {
+ [, $column] = preg_split('/ as /i', $column);
+ }
if (str_contains($column, '.')) {
[, $column] = explode('.', $column);
}
@@ -591,14 +594,7 @@ class QueryBuilder implements IQueryBuilder {
}
public function getOutputColumns(): array {
- return array_unique(array_map(function (string $column) {
- if (str_contains($column, '.')) {
- [, $column] = explode('.', $column);
- return $column;
- } else {
- return $column;
- }
- }, $this->selectedColumns));
+ return array_unique($this->selectedColumns);
}
/**