mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 15:54:03 +02:00
StateHistoryQuery: tune type queries
This commit is contained in:
parent
adab58e769
commit
cbaa2d8ae9
@ -6,6 +6,11 @@ namespace Icinga\Module\Monitoring\Backend\Ido\Query;
|
|||||||
|
|
||||||
class StatehistoryQuery extends IdoQuery
|
class StatehistoryQuery extends IdoQuery
|
||||||
{
|
{
|
||||||
|
protected $types = array(
|
||||||
|
'soft_state' => 0,
|
||||||
|
'hard_state' => 1,
|
||||||
|
);
|
||||||
|
|
||||||
protected $columnMap = array(
|
protected $columnMap = array(
|
||||||
'statehistory' => array(
|
'statehistory' => array(
|
||||||
'raw_timestamp' => 'sh.state_time',
|
'raw_timestamp' => 'sh.state_time',
|
||||||
@ -33,6 +38,8 @@ class StatehistoryQuery extends IdoQuery
|
|||||||
{
|
{
|
||||||
if ($col === 'UNIX_TIMESTAMP(sh.state_time)') {
|
if ($col === 'UNIX_TIMESTAMP(sh.state_time)') {
|
||||||
return 'sh.state_time ' . $sign . ' ' . $this->timestampForSql($this->valueToTimestamp($expression));
|
return 'sh.state_time ' . $sign . ' ' . $this->timestampForSql($this->valueToTimestamp($expression));
|
||||||
|
} elseif ($col === $this->columnMap['statehistory']['type']) {
|
||||||
|
return 'sh.state_type ' . $sign . ' ' . $this->types[$expression];
|
||||||
} else {
|
} else {
|
||||||
return parent::whereToSql($col, $sign, $expression);
|
return parent::whereToSql($col, $sign, $expression);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user