2014-07-30 Miguel de Dios <miguel.dedios@artica.es>

* include/ajax/module.php: tiny fixes for the improve the support of
	postgreSQL databases.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10367 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2014-07-30 16:54:10 +00:00
parent 8ed6e5b5d4
commit 61100077c1
2 changed files with 23 additions and 13 deletions

View File

@ -1,16 +1,7 @@
2014-07-30 Alejandro Gallardo <alejandro.gallardo@artica.es> 2014-07-30 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php: Finished the function * include/ajax/module.php: tiny fixes for the improve the support of
"graph_monitor_wheel". This function returns a sunburst postgreSQL databases.
graph representing all the group>agent>module group>module
hierarchy.
* include/functions_groups.php: Added the function
"groups_get_tree". This function returns an array representing
the group hierarchy of the passed groups array.
* include/graphs/pandora.d3.js: Improved the function
"sunburst". Now this graph can show tooltips.
2014-07-30 Miguel de Dios <miguel.dedios@artica.es> 2014-07-30 Miguel de Dios <miguel.dedios@artica.es>

View File

@ -89,6 +89,9 @@ if ($get_module_detail) {
$conexion = mysql_connect ($server['dbhost'], $server['dbuser'], $server['dbpass']); $conexion = mysql_connect ($server['dbhost'], $server['dbuser'], $server['dbpass']);
$select_db = mysql_select_db ($server['dbname'], $conexion); $select_db = mysql_select_db ($server['dbname'], $conexion);
} }
else {
$conexion = false;
}
$selection_mode = get_parameter('selection_mode', 'fromnow'); $selection_mode = get_parameter('selection_mode', 'fromnow');
$date_from = (string) get_parameter ('date_from', date ('Y-m-j')); $date_from = (string) get_parameter ('date_from', date ('Y-m-j'));
@ -230,14 +233,30 @@ if ($get_module_detail) {
); );
} }
$sql_body = io_safe_output($sql_body); $sql_body = io_safe_output($sql_body);
// Clean all codification characters // Clean all codification characters
$sql = "SELECT * " . $sql_body; $sql = "SELECT * " . $sql_body;
switch ($config['dbtype']) {
case "mysql":
$sql_count = "SELECT count(*) " . $sql_body; $sql_count = "SELECT count(*) " . $sql_body;
break;
case "postgresql":
$sql_body = str_replace("ORDER BY utimestamp DESC",
"GROUP BY utimestamp ORDER BY utimestamp DESC",
$sql_body);
$sql_count = "SELECT count(DISTINCT utimestamp) " . $sql_body;
break;
case "oracle":
$sql_count = "SELECT count(*) " . $sql_body;
break;
}
$count = db_get_value_sql ($sql_count, $conexion); $count = db_get_value_sql ($sql_count, $conexion);
switch ($config["dbtype"]) { switch ($config["dbtype"]) {
case "mysql": case "mysql":
$sql .= " LIMIT " . $offset . "," . $block_size; $sql .= " LIMIT " . $offset . "," . $block_size;