mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-29 08:44:10 +02:00
IdoQuery: Fix that PostgreSQL queries do not apply LOWER() on order cols
refs #10364 refs #9955
This commit is contained in:
parent
22f966db43
commit
39f4d869b7
@ -421,26 +421,32 @@ abstract class IdoQuery extends DbQuery
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Order the result by the given column
|
* Order the result by the given alias
|
||||||
*
|
*
|
||||||
* @param string $columnOrAlias The column or column alias to order by
|
* @param string $alias The column alias to order by
|
||||||
* @param int $dir The sort direction or null to use default direction
|
* @param int $dir The sort direction or null to use the default direction
|
||||||
*
|
*
|
||||||
* @return $this Fluent interface
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function order($columnOrAlias, $dir = null)
|
public function order($alias, $dir = null)
|
||||||
{
|
{
|
||||||
$this->requireColumn($columnOrAlias);
|
$this->requireColumn($alias);
|
||||||
$this->orderColumns[$columnOrAlias] = $columnOrAlias;
|
|
||||||
if ($this->isCustomvar($columnOrAlias)) {
|
if ($this->isCustomvar($alias)) {
|
||||||
$columnOrAlias = $this->getCustomvarColumnName($columnOrAlias);
|
$column = $this->getCustomvarColumnName($alias);
|
||||||
} elseif ($this->hasAliasName($columnOrAlias)) {
|
} elseif ($this->hasAliasName($alias)) {
|
||||||
$columnOrAlias = $this->aliasToColumnName($columnOrAlias);
|
$column = $this->aliasToColumnName($alias);
|
||||||
|
$table = $this->aliasToTableName($alias);
|
||||||
|
if (isset($this->caseInsensitiveColumns[$table][$alias])) {
|
||||||
|
$column = 'LOWER(' . $column . ')';
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Logger::info('Can\'t order by column ' . $columnOrAlias);
|
Logger::info('Can\'t order by column ' . $alias);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
return parent::order($columnOrAlias, $dir);
|
|
||||||
|
$this->orderColumns[$alias] = $alias;
|
||||||
|
return parent::order($column, $dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user