Fixed problems with oracle in snmp console. Tiquet: #2943
(cherry picked from commit b4ebdb1c8e
)
This commit is contained in:
parent
601ff4e4c8
commit
ca67569afa
|
@ -175,26 +175,31 @@ foreach ($all_traps as $trap) {
|
|||
|
||||
|
||||
|
||||
$rows = db_get_all_rows_filter('tagente',
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
case "postgresql":
|
||||
$rows = db_get_all_rows_filter('tagente',
|
||||
array('id_grupo' => array_keys($user_groups)),
|
||||
array('id_agente'));
|
||||
$id_agents = array();
|
||||
foreach ($rows as $row)
|
||||
$id_agents = array();
|
||||
foreach ($rows as $row)
|
||||
$id_agents[] = $row['id_agente'];
|
||||
$address_by_user_groups = agents_get_addresses($id_agents);
|
||||
foreach ($address_by_user_groups as $i => $a)
|
||||
$address_by_user_groups = agents_get_addresses($id_agents);
|
||||
foreach ($address_by_user_groups as $i => $a)
|
||||
$address_by_user_groups[$i] = '"' . $a . '"';
|
||||
|
||||
$rows = db_get_all_rows_filter('tagente',
|
||||
$rows = db_get_all_rows_filter('tagente',
|
||||
array(),
|
||||
array('id_agente'));
|
||||
$id_agents = array();
|
||||
foreach ($rows as $row)
|
||||
$id_agents = array();
|
||||
foreach ($rows as $row)
|
||||
$id_agents[] = $row['id_agente'];
|
||||
$all_address_agents = agents_get_addresses($id_agents);
|
||||
foreach ($all_address_agents as $i => $a)
|
||||
$all_address_agents = agents_get_addresses($id_agents);
|
||||
foreach ($all_address_agents as $i => $a)
|
||||
$all_address_agents[$i] = '"' . $a . '"';
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//Make query to extract traps of DB.
|
||||
|
@ -233,7 +238,11 @@ switch ($config["dbtype"]) {
|
|||
ORDER BY timestamp DESC";
|
||||
break;
|
||||
}
|
||||
$sql_all = "SELECT *
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
case "postgresql":
|
||||
$sql_all = "SELECT *
|
||||
FROM ttrap
|
||||
WHERE (
|
||||
source IN (" . implode(",", $address_by_user_groups) . ") OR
|
||||
|
@ -242,7 +251,7 @@ $sql_all = "SELECT *
|
|||
)
|
||||
%s
|
||||
ORDER BY timestamp DESC";
|
||||
$sql_count = "SELECT COUNT(id_trap)
|
||||
$sql_count = "SELECT COUNT(id_trap)
|
||||
FROM ttrap
|
||||
WHERE (
|
||||
source IN (" . implode(",", $address_by_user_groups) . ") OR
|
||||
|
@ -250,6 +259,26 @@ $sql_count = "SELECT COUNT(id_trap)
|
|||
source NOT IN (" . implode(",", $all_address_agents) . ")
|
||||
)
|
||||
%s";
|
||||
break;
|
||||
case "oracle":
|
||||
$sql_all = "SELECT *
|
||||
FROM ttrap
|
||||
WHERE (source IN (
|
||||
SELECT direccion FROM tagente
|
||||
WHERE id_grupo IN ($str_user_groups)
|
||||
) OR source='' OR source NOT IN (SELECT direccion FROM tagente))
|
||||
%s
|
||||
ORDER BY timestamp DESC";
|
||||
$sql_count = "SELECT COUNT(id_trap)
|
||||
FROM ttrap
|
||||
WHERE (
|
||||
source IN (
|
||||
SELECT direccion FROM tagente
|
||||
WHERE id_grupo IN ($str_user_groups)
|
||||
) OR source='' OR source NOT IN (SELECT direccion FROM tagente))
|
||||
%s";
|
||||
break;
|
||||
}
|
||||
//$whereSubquery = 'WHERE 1=1';
|
||||
$whereSubquery = '';
|
||||
|
||||
|
|
Loading…
Reference in New Issue