Support Icinga 2.6 IDO w/ PostgreSQL

This commit is contained in:
Alexander A. Klimov 2016-12-09 11:57:56 +01:00
parent bcc5b8c1a7
commit 665557be27

View File

@ -655,6 +655,9 @@ abstract class IdoQuery extends DbQuery
'(CASE WHEN $1 ~ \'(?:[0-9]{1,3}\\\\.){3}[0-9]{1,3}\' THEN $1::inet - \'0.0.0.0\' ELSE NULL END)', '(CASE WHEN $1 ~ \'(?:[0-9]{1,3}\\\\.){3}[0-9]{1,3}\' THEN $1::inet - \'0.0.0.0\' ELSE NULL END)',
$column $column
); );
if (version_compare($this->getIdoVersion(), '1.14.2', '>=')) {
$column = str_replace('NOW()', 'localtimestamp', $column);
} else {
$column = preg_replace( $column = preg_replace(
'/UNIX_TIMESTAMP(\((?>[^()]|(?-1))*\))/i', '/UNIX_TIMESTAMP(\((?>[^()]|(?-1))*\))/i',
'CASE WHEN ($1 < \'1970-01-03 00:00:00+00\'::timestamp with time zone) THEN 0 ELSE UNIX_TIMESTAMP($1) END', 'CASE WHEN ($1 < \'1970-01-03 00:00:00+00\'::timestamp with time zone) THEN 0 ELSE UNIX_TIMESTAMP($1) END',
@ -663,6 +666,7 @@ abstract class IdoQuery extends DbQuery
} }
} }
} }
}
/** /**
* Set up this query and join the initial tables * Set up this query and join the initial tables