Fixes to improve the oracle compatibility
This commit is contained in:
parent
c8806ef1dc
commit
9867fb6bd7
|
@ -647,21 +647,34 @@ sub pandora_execute_alert ($$$$$$$$;$) {
|
||||||
|
|
||||||
# Simple alert
|
# Simple alert
|
||||||
if (defined ($alert->{'id_template_module'})) {
|
if (defined ($alert->{'id_template_module'})) {
|
||||||
|
# Avoid the use of something like "SELECT *, <column that exists in the *>" cause
|
||||||
|
# it will make an error on oracle databases. It's better to filter the wildcards
|
||||||
|
# by table and add (one by one) all the columns of the table which will have columns
|
||||||
|
# that will be modified with an alias or something.
|
||||||
|
|
||||||
if ($alert_mode == RECOVERED_ALERT) {
|
if ($alert_mode == RECOVERED_ALERT) {
|
||||||
@actions = get_db_rows ($dbh, 'SELECT *, talert_template_module_actions.id AS id_alert_template_module_actions
|
# Avoid the use of alias bigger than 30 characters.
|
||||||
FROM talert_template_module_actions, talert_actions, talert_commands
|
@actions = get_db_rows ($dbh,
|
||||||
WHERE talert_template_module_actions.id_alert_action = talert_actions.id
|
'SELECT taa.*, tac.*, tatma.id AS id_alert_templ_module_actions,
|
||||||
AND talert_actions.id_alert_command = talert_commands.id
|
tatma.id_alert_template_module, tatma.id_alert_action, tatma.fires_min,
|
||||||
AND talert_template_module_actions.id_alert_template_module = ?
|
tatma.fires_max, tatma.module_action_threshold, tatma.last_execution
|
||||||
|
FROM talert_template_module_actions tatma, talert_actions taa, talert_commands tac
|
||||||
|
WHERE tatma.id_alert_action = taa.id
|
||||||
|
AND taa.id_alert_command = tac.id
|
||||||
|
AND tatma.id_alert_template_module = ?
|
||||||
AND ((fires_min = 0 AND fires_max = 0)
|
AND ((fires_min = 0 AND fires_max = 0)
|
||||||
OR ? >= fires_min)',
|
OR ? >= fires_min)',
|
||||||
$alert->{'id_template_module'}, $alert->{'times_fired'});
|
$alert->{'id_template_module'}, $alert->{'times_fired'});
|
||||||
} else {
|
} else {
|
||||||
@actions = get_db_rows ($dbh, 'SELECT *, talert_template_module_actions.id AS id_alert_template_module_actions
|
# Avoid the use of alias bigger than 30 characters.
|
||||||
FROM talert_template_module_actions, talert_actions, talert_commands
|
@actions = get_db_rows ($dbh,
|
||||||
WHERE talert_template_module_actions.id_alert_action = talert_actions.id
|
'SELECT taa.*, tac.*, tatma.id AS id_alert_templ_module_actions,
|
||||||
AND talert_actions.id_alert_command = talert_commands.id
|
tatma.id_alert_template_module, tatma.id_alert_action, tatma.fires_min,
|
||||||
AND talert_template_module_actions.id_alert_template_module = ?
|
tatma.fires_max, tatma.module_action_threshold, tatma.last_execution
|
||||||
|
FROM talert_template_module_actions tatma, talert_actions taa, talert_commands tac
|
||||||
|
WHERE tatma.id_alert_action = taa.id
|
||||||
|
AND taa.id_alert_command = tac.id
|
||||||
|
AND tatma.id_alert_template_module = ?
|
||||||
AND ((fires_min = 0 AND fires_max = 0)
|
AND ((fires_min = 0 AND fires_max = 0)
|
||||||
OR (fires_min <= fires_max AND ? >= fires_min AND ? <= fires_max)
|
OR (fires_min <= fires_max AND ? >= fires_min AND ? <= fires_max)
|
||||||
OR (fires_min > fires_max AND ? >= fires_min))',
|
OR (fires_min > fires_max AND ? >= fires_min))',
|
||||||
|
@ -1189,9 +1202,9 @@ sub pandora_execute_action ($$$$$$$$$;$) {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Update action last execution date
|
# Update action last execution date
|
||||||
if (defined ($action->{'last_execution'}) && defined ($action->{'id_alert_template_module_actions'})) {
|
if (defined ($action->{'last_execution'}) && defined ($action->{'id_alert_templ_module_actions'})) {
|
||||||
db_do ($dbh, 'UPDATE talert_template_module_actions SET last_execution = ?
|
db_do ($dbh, 'UPDATE talert_template_module_actions SET last_execution = ?
|
||||||
WHERE id = ?', time (), $action->{'id_alert_template_module_actions'});
|
WHERE id = ?', time (), $action->{'id_alert_templ_module_actions'});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue