More Oracle related fixes.

This commit is contained in:
Ramon Novoa 2015-05-05 11:57:50 +02:00
parent 6255d5c3bf
commit 615231eafd
1 changed files with 33 additions and 34 deletions

View File

@ -1418,10 +1418,10 @@ sub pandora_planned_downtime_disabled_once_stop($$) {
# Stop executed downtimes (enable agents and disable_agents_alerts) # Stop executed downtimes (enable agents and disable_agents_alerts)
my @downtimes = get_db_rows($dbh, 'SELECT * my @downtimes = get_db_rows($dbh, 'SELECT *
FROM tplanned_downtime FROM tplanned_downtime
WHERE type_downtime != ' . $RDBMS_QUOTE_STRING. 'quiet' . $RDBMS_QUOTE_STRING. ' WHERE type_downtime != ?
AND type_execution = ' . $RDBMS_QUOTE_STRING. 'once' . $RDBMS_QUOTE_STRING. ' AND type_execution = ?
AND executed = 1 AND executed = 1
AND date_to <= ?', $utimestamp); AND date_to <= ?', 'quiet', 'once', $utimestamp);
foreach my $downtime (@downtimes) { foreach my $downtime (@downtimes) {
@ -1453,10 +1453,10 @@ sub pandora_planned_downtime_disabled_once_start($$) {
# Start pending downtimes (disable agents and disable_agents_alerts) # Start pending downtimes (disable agents and disable_agents_alerts)
my @downtimes = get_db_rows($dbh, 'SELECT * my @downtimes = get_db_rows($dbh, 'SELECT *
FROM tplanned_downtime FROM tplanned_downtime
WHERE type_downtime != ' . $RDBMS_QUOTE_STRING . 'quiet' . $RDBMS_QUOTE_STRING . ' WHERE type_downtime != ?
AND type_execution = ' . $RDBMS_QUOTE_STRING . 'once' . $RDBMS_QUOTE_STRING . ' AND type_execution = ?
AND executed = 0 AND date_from <= ? AND executed = 0 AND date_from <= ?
AND date_to >= ?', $utimestamp, $utimestamp); AND date_to >= ?', 'quiet', 'once', $utimestamp, $utimestamp);
foreach my $downtime (@downtimes) { foreach my $downtime (@downtimes) {
if (!defined($downtime->{'description'})) { if (!defined($downtime->{'description'})) {
@ -1651,9 +1651,9 @@ sub pandora_planned_downtime_quiet_once_stop($$) {
# Stop pending downtimes # Stop pending downtimes
my @downtimes = get_db_rows($dbh, 'SELECT * my @downtimes = get_db_rows($dbh, 'SELECT *
FROM tplanned_downtime FROM tplanned_downtime
WHERE type_downtime = ' . $RDBMS_QUOTE_STRING . 'quiet' . $RDBMS_QUOTE_STRING . ' WHERE type_downtime = ?
AND type_execution = ' . $RDBMS_QUOTE_STRING. 'once' . $RDBMS_QUOTE_STRING . ' AND type_execution = ?
AND executed = 1 AND date_to <= ?', $utimestamp); AND executed = 1 AND date_to <= ?', 'quiet', 'once', $utimestamp);
foreach my $downtime (@downtimes) { foreach my $downtime (@downtimes) {
if (!defined($downtime->{'description'})) { if (!defined($downtime->{'description'})) {
@ -1692,10 +1692,10 @@ sub pandora_planned_downtime_quiet_once_start($$) {
# Start pending downtimes # Start pending downtimes
my @downtimes = get_db_rows($dbh, 'SELECT * my @downtimes = get_db_rows($dbh, 'SELECT *
FROM tplanned_downtime FROM tplanned_downtime
WHERE type_downtime = ' . $RDBMS_QUOTE_STRING . 'quiet' . $RDBMS_QUOTE_STRING . ' WHERE type_downtime = ?
AND type_execution = ' . $RDBMS_QUOTE_STRING . 'once' . $RDBMS_QUOTE_STRING . ' AND type_execution = ?
AND executed = 0 AND date_from <= ? AND executed = 0 AND date_from <= ?
AND date_to >= ?', $utimestamp, $utimestamp); AND date_to >= ?', 'quiet', 'once', $utimestamp, $utimestamp);
foreach my $downtime (@downtimes) { foreach my $downtime (@downtimes) {
if (!defined($downtime->{'description'})) { if (!defined($downtime->{'description'})) {
@ -1743,11 +1743,12 @@ sub pandora_planned_downtime_monthly_start($$) {
# Start pending downtimes # Start pending downtimes
my @downtimes = get_db_rows($dbh, 'SELECT * my @downtimes = get_db_rows($dbh, 'SELECT *
FROM tplanned_downtime FROM tplanned_downtime
WHERE type_periodicity = ' . $RDBMS_QUOTE_STRING . 'monthly' . $RDBMS_QUOTE_STRING . ' WHERE type_periodicity = ?
AND executed = 0 AND executed = 0
AND ((periodically_day_from = ? AND periodically_time_from <= ?) OR (periodically_day_from < ?)) AND ((periodically_day_from = ? AND periodically_time_from <= ?) OR (periodically_day_from < ?))
AND ((periodically_day_to = ? AND periodically_time_to >= ?) OR (periodically_day_to > ?))', AND ((periodically_day_to = ? AND periodically_time_to >= ?) OR (periodically_day_to > ?))',
$number_day_month, $time, $number_day_month, 'monthly', 'number_day_month',
$time, $number_day_month,
$number_day_month, $time, $number_day_month); $number_day_month, $time, $number_day_month);
foreach my $downtime (@downtimes) { foreach my $downtime (@downtimes) {
@ -1817,11 +1818,12 @@ sub pandora_planned_downtime_monthly_stop($$) {
# Start pending downtimes # Start pending downtimes
my @downtimes = get_db_rows($dbh, 'SELECT * my @downtimes = get_db_rows($dbh, 'SELECT *
FROM tplanned_downtime FROM tplanned_downtime
WHERE type_periodicity = ' . $RDBMS_QUOTE_STRING . 'monthly' . $RDBMS_QUOTE_STRING . ' WHERE type_periodicity = ?
AND executed = 1 AND executed = 1
AND type_execution <> ' . $RDBMS_QUOTE_STRING . 'once' . $RDBMS_QUOTE_STRING . ' AND type_execution <> ?
AND (((periodically_day_from = ? AND periodically_time_from > ?) OR (periodically_day_from > ?)) AND (((periodically_day_from = ? AND periodically_time_from > ?) OR (periodically_day_from > ?))
OR ((periodically_day_to = ? AND periodically_time_to < ?) OR (periodically_day_to < ?)))', OR ((periodically_day_to = ? AND periodically_time_to < ?) OR (periodically_day_to < ?)))',
'monthly', 'once',
$number_day_month, $time, $number_day_month, $number_day_month, $time, $number_day_month,
$number_day_month, $time, $number_day_month); $number_day_month, $time, $number_day_month);
@ -1876,8 +1878,8 @@ sub pandora_planned_downtime_weekly_start($$) {
# Start pending downtimes # Start pending downtimes
my @downtimes = get_db_rows($dbh, 'SELECT * my @downtimes = get_db_rows($dbh, 'SELECT *
FROM tplanned_downtime FROM tplanned_downtime
WHERE type_periodicity = ' . $RDBMS_QUOTE_STRING . 'weekly' . $RDBMS_QUOTE_STRING . ' WHERE type_periodicity = ?
AND executed = 0'); AND executed = 0', 'weekly');
foreach my $downtime (@downtimes) { foreach my $downtime (@downtimes) {
my $across_date = $downtime->{'periodically_time_from'} gt $downtime->{'periodically_time_to'} ? 1 : 0 ; my $across_date = $downtime->{'periodically_time_from'} gt $downtime->{'periodically_time_to'} ? 1 : 0 ;
@ -1985,9 +1987,9 @@ sub pandora_planned_downtime_weekly_stop($$) {
# Start pending downtimes # Start pending downtimes
my @downtimes = get_db_rows($dbh, 'SELECT * my @downtimes = get_db_rows($dbh, 'SELECT *
FROM tplanned_downtime FROM tplanned_downtime
WHERE type_periodicity = ' . $RDBMS_QUOTE_STRING . 'weekly' . $RDBMS_QUOTE_STRING . ' WHERE type_periodicity = ?
AND type_execution <> ' . $RDBMS_QUOTE_STRING . 'once' . $RDBMS_QUOTE_STRING . ' AND type_execution <> ?
AND executed = 1'); AND executed = 1', 'weekly', 'once');
foreach my $downtime (@downtimes) { foreach my $downtime (@downtimes) {
my $across_date = $downtime->{'periodically_time_from'} gt $downtime->{'periodically_time_to'} ? 1 : 0; my $across_date = $downtime->{'periodically_time_from'} gt $downtime->{'periodically_time_to'} ? 1 : 0;
@ -2311,13 +2313,12 @@ sub pandora_create_template_module ($$$$;$$$) {
return db_insert ($dbh, return db_insert ($dbh,
'id', 'id',
"INSERT INTO talert_template_modules( "INSERT INTO talert_template_modules(id_agent_module,
" . $RDBMS_QUOTE . "id_agent_module" . $RDBMS_QUOTE . ", id_alert_template,
" . $RDBMS_QUOTE . "id_alert_template" . $RDBMS_QUOTE . ", id_policy_alerts,
" . $RDBMS_QUOTE . "id_policy_alerts" . $RDBMS_QUOTE . ", disabled,
" . $RDBMS_QUOTE . "disabled" . $RDBMS_QUOTE . ", standby,
" . $RDBMS_QUOTE . "standby" . $RDBMS_QUOTE . ", last_reference)
" . $RDBMS_QUOTE . "last_reference" . $RDBMS_QUOTE . ")
VALUES (?, ?, ?, ?, ?, ?)", VALUES (?, ?, ?, ?, ?, ?)",
$id_agent_module, $id_alert_template, $id_policy_alerts, $disabled, $standby, time); $id_agent_module, $id_alert_template, $id_policy_alerts, $disabled, $standby, time);
} }
@ -2339,9 +2340,9 @@ sub pandora_update_template_module ($$$;$$$) {
db_do ($dbh, db_do ($dbh,
"UPDATE talert_template_modules "UPDATE talert_template_modules
SET " . $RDBMS_QUOTE . "id_policy_alerts" . $RDBMS_QUOTE . " = ?, SET id_policy_alerts = ?,
" . $RDBMS_QUOTE . "disabled" . $RDBMS_QUOTE . " = ?, disabled = ?,
" . $RDBMS_QUOTE . "standby" . $RDBMS_QUOTE . " = ? standby = ?
WHERE id = ?", WHERE id = ?",
$id_policy_alerts, $disabled, $standby, $id_alert); $id_policy_alerts, $disabled, $standby, $id_alert);
} }
@ -2706,9 +2707,7 @@ sub pandora_create_module_tags ($$$$) {
db_insert ($dbh, db_insert ($dbh,
'id_tag', 'id_tag',
"INSERT INTO ttag_module( "INSERT INTO ttag_module(id_tag, id_agente_modulo)
" . $RDBMS_QUOTE . "id_tag" . $RDBMS_QUOTE . ",
" . $RDBMS_QUOTE . "id_agente_modulo" . $RDBMS_QUOTE . ")
VALUES (?, ?)", VALUES (?, ?)",
$tag_id, $id_agent_module); $tag_id, $id_agent_module);
} }