2011-05-17 Juan Manuel Ramon <juanmanuel.ramon@artica.es>

* include/graphs/fgraph.php
	include/config_process.php
	include/functions_agents.php
	operation/agentes/status_monitor.php
	operation/agentes/estado_agente.php: Several corrections 
	over sql queries for Oracle DBMS.
	* godmode/db/db_info.php: Added include to 
	functions_fsgraph.php



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4363 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
juanmanuelr 2011-05-17 15:59:40 +00:00
parent 8116e4b51e
commit 194478e887
7 changed files with 96 additions and 42 deletions

View File

@ -1,3 +1,14 @@
2011-05-17 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/graphs/fgraph.php
include/config_process.php
include/functions_agents.php
operation/agentes/status_monitor.php
operation/agentes/estado_agente.php: Several corrections
over sql queries for Oracle DBMS.
* godmode/db/db_info.php: Added include to
functions_fsgraph.php
2011-05-17 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/graphs/fgraph.php

View File

@ -21,6 +21,7 @@ global $config;
require_once ($config["homedir"] . '/include/functions_graph.php');
require_once($config['homedir'] . "/include/functions_agents.php");
require_once($config['homedir'] . "/include/functions_modules.php");
require_once($config['homedir'] . "/include/functions_fsgraph.php");
ui_print_page_header (__('Database maintenance').' &raquo; '.__('Database information'), "images/god8.png", false, "", true);

View File

@ -152,7 +152,22 @@ if (isset($config['history_db_enabled'])) {
// Make dbconnection the default connection again (the link identifier of the already opened link will be returned)
db_connect();
require_once("include/fgraph.php");
function include_graphs_dependencies($home_url = '', $serialize_ttl = 1) {
global $ttl;
global $homeurl;
$ttl = $serialize_ttl;
$homeurl = $home_url;
include_once($homeurl . 'include/functions.php');
include_once($homeurl . 'include/functions_html.php');
include_once($homeurl . 'include/graphs/functions_fsgraph.php');
include_once($homeurl . 'include/graphs/functions_gd.php');
include_once($homeurl . 'include/graphs/functions_utils.php');
}
//require_once("include/fgraph.php");
include_graphs_dependencies();
?>

View File

@ -803,7 +803,7 @@ function agents_get_group_agents ($id_group = 0, $search = false, $case = "lower
$search_sql .= ' AND nombre COLLATE utf8_general_ci LIKE \'' . $name . '\' ';
break;
case "oracle":
$search_sql .= ' AND nombre LIKE UPPER("' . $name . '") ';
$search_sql .= ' AND UPPER(nombre) LIKE UPPER(\'' . $name . '\') ';
break;
}
@ -958,13 +958,29 @@ function agents_get_modules ($id_agent = null, $details = false, $filter = false
}
if ($value[0] == '%') {
switch ($config['dbtype']){
case "mysql":
case "postgresql":
array_push ($fields, $field.' LIKE "'.$value.'"');
break;
case "oracle":
array_push ($fields, $field.' LIKE \''.$value.'\'');
break;
}
}
else if ($operatorDistin) {
array_push($fields, $field.' <> ' . substr($value, 2));
}
else if (substr($value, -1) == '%') {
switch ($config['dbtype']){
case "mysql":
case "postgresql":
array_push ($fields, $field.' LIKE "'.$value.'"');
break;
case "oracle":
array_push ($fields, $field.' LIKE \''.$value.'\'');
break;
}
}
else {
switch ($config["dbtype"]) {

View File

@ -13,7 +13,7 @@
$ttl = 1;
$homeurl = '';
function include_graphs_dependencies($home_url = '', $serialize_ttl = 1) {
/*function include_graphs_dependencies($home_url = '', $serialize_ttl = 1) {
global $ttl;
global $homeurl;
@ -26,7 +26,7 @@ function include_graphs_dependencies($home_url = '', $serialize_ttl = 1) {
include_once($homeurl . 'include/graphs/functions_fsgraph.php');
include_once($homeurl . 'include/graphs/functions_gd.php');
include_once($homeurl . 'include/graphs/functions_utils.php');
}
}*/
/*
// If is called from index
if(file_exists('include/functions.php')) {

View File

@ -60,6 +60,15 @@ if (is_ajax ()) {
ORDER BY sort_order DESC", $id_template, $filter_groups);
break;
case "oracle":
$sql = sprintf ("SELECT t1.id, t1.name,
(SELECT COUNT(t2.id)
FROM talert_templates t2
WHERE t2.id = %d
AND t2.id_alert_action = t1.id) as sort_order
FROM talert_actions t1
WHERE id_group IN (%s)
ORDER BY sort_order DESC", $id_template, $filter_groups);
break;
case "postgresql":
$sql = sprintf ("SELECT t1.id, t1.name,
(SELECT COUNT(t2.id)

View File

@ -129,44 +129,46 @@ switch ($config["dbtype"]) {
$sql .= ')';
break;
case "oracle":
//TODO PENDING TO OPTIMIZE
$names = oracle_db_get_all_rows_filter ('user_tab_columns',array ('table_name' => 'TAGENTE_MODULO', 'column_name' => '<>NOMBRE'), 'column_name');
$column_names = '';
foreach ($names as $column_name => $value) {
$column_names .= $value['column_name'] . ',';
$profiles = db_get_all_rows_sql('SELECT id_grupo
FROM tusuario_perfil t1
INNER JOIN tperfil t2 ON t1.id_perfil = t2.id_perfil
WHERE t2.agent_view = 1 AND t1.id_usuario = \'' . $config['id_user'] . '\';');
if ($profiles === false)
$profiles = array();
$id_groups = array();
$flag_all_group = false;
foreach ($profiles as $profile) {
if ($profile['id_grupo'] == 0) {
$flag_all_group = true;
}
$id_groups[] = $profile['id_grupo'];
}
$column_names = substr($column_names,0,-1);
$sql = '
select nombre
from (select distinct dbms_lob.substr(nombre,4000,1) as nombre, ' . $column_names .' from tagente_modulo)
where nombre <> \'delete_pending\' ' . $subquery_enterprise . ' AND id_agente in
//The check of is_admin
$flag_is_admin = (bool)db_get_value('is_admin', 'tusuario', 'id_user', $config['id_user']);
$sql = ' SELECT distinct dbms_lob.substr(nombre,4000,1) as nombre
FROM tagente_modulo
WHERE dbms_lob.substr(nombre,4000,1) <> \'delete_pending\' ' . $subquery_enterprise . ' AND id_agente IN
(
select id_agente
from tagente where id_grupo IN (
select id_grupo
from tusuario_perfil
where id_usuario = \'' . $config['id_user'] . '\'
and id_perfil IN (
select id_perfil
from tperfil where agent_view = 1
)
)
OR
(1 = (
SELECT is_admin FROM tusuario WHERE id_user = \'' . $config['id_user'] . '\'
)
)
OR 0 IN (
select id_grupo
from tusuario_perfil
where id_usuario = \'' . $config['id_user'] . '\'
and id_perfil IN (
select id_perfil
from tperfil where agent_view = 1
)
)
)';
SELECT id_agente
FROM tagente
WHERE';
if ($flag_is_admin || $flag_all_group) {
$sql .= ' 1 = 1 ';
}
else {
if (empty($id_groups)) {
$sql .= ' 1 = 0 ';
}
else {
$sql .= ' id_grupo IN (' . implode(',', $id_groups) . ') ';
}
}
$sql .= ')';
break;
}