aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/DB
diff options
context:
space:
mode:
authorprovokateurin <kate@provokateurin.de>2024-10-02 11:55:27 +0200
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2024-10-03 13:49:00 +0000
commitaab30afc25f43960bef7f2ee2f507c83283a8afe (patch)
treed4177a80c98903ad47e68229c2ff7036f13cee85 /lib/private/DB
parentfaf9b891e68841b43e6af9654f511b8296967b50 (diff)
downloadnextcloud-server-aab30afc25f43960bef7f2ee2f507c83283a8afe.tar.gz
nextcloud-server-aab30afc25f43960bef7f2ee2f507c83283a8afe.zip
fix(QueryBuilder): Account for aliases in output columnsbackport/48522/stable30
Signed-off-by: provokateurin <kate@provokateurin.de>
Diffstat (limited to 'lib/private/DB')
-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 8432881b490..56187edb3b6 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);
}
/**