2011-10-26 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/db/postgresql.php include/db/mysql.php include/db/oracle.php include/config_process.php include/functions_db.php: Fixed historic database functionality. Fixes: #3423519 * operation/agentes/datos_agente.php: Fixed layout in this view. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5082 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
c841a57c64
commit
1082268804
|
@ -1,3 +1,15 @@
|
|||
2011-10-26 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
|
||||
|
||||
* include/db/postgresql.php
|
||||
include/db/mysql.php
|
||||
include/db/oracle.php
|
||||
include/config_process.php
|
||||
include/functions_db.php: Fixed historic database functionality.
|
||||
|
||||
Fixes: #3423519
|
||||
|
||||
* operation/agentes/datos_agente.php: Fixed layout in this view.
|
||||
|
||||
2011-10-26 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
|
||||
|
||||
* include/functions_graph.php
|
||||
|
|
|
@ -145,10 +145,11 @@ else {
|
|||
// Connect to the history DB
|
||||
if (isset($config['history_db_enabled'])) {
|
||||
if ($config['history_db_enabled']) {
|
||||
$config['history_db_connection'] = db_connect(
|
||||
/*$config['history_db_connection'] =*/ db_connect(
|
||||
$config['history_db_host'] . ':' . $config['history_db_port'],
|
||||
$config['history_db_name'],
|
||||
$config['history_db_user'],
|
||||
$config['history_db_pass']);
|
||||
$config['history_db_pass'], true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
function mysql_connect_db($host = null, $db = null, $user = null, $pass = null) {
|
||||
function mysql_connect_db($host = null, $db = null, $user = null, $pass = null, $history = null) {
|
||||
global $config;
|
||||
|
||||
if ($host === null)
|
||||
|
@ -28,15 +28,31 @@ function mysql_connect_db($host = null, $db = null, $user = null, $pass = null)
|
|||
|
||||
// Non-persistent connection: This will help to avoid mysql errors like "has gone away" or locking problems
|
||||
// If you want persistent connections change it to mysql_pconnect().
|
||||
$config['dbconnection'] = mysql_connect($host, $user, $pass);
|
||||
mysql_select_db($db, $config['dbconnection']);
|
||||
|
||||
$connect_id = mysql_connect($host, $user, $pass);
|
||||
mysql_select_db($db, $connect_id);
|
||||
|
||||
if (! $config['dbconnection']) {
|
||||
if (! $connect_id) {
|
||||
include ($config["homedir"]."/general/error_authconfig.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
return $config['dbconnection'];
|
||||
if ($history){
|
||||
$config['history_db_dbconnection'] = $connect_id;
|
||||
}
|
||||
else{
|
||||
$config['dbconnection'] = $connect_id;
|
||||
}
|
||||
//$config['dbconnection'] = mysql_connect($host, $user, $pass);
|
||||
//mysql_select_db($db, $config['dbconnection']);
|
||||
|
||||
//if (! $config['dbconnection']) {
|
||||
// include ($config["homedir"]."/general/error_authconfig.php");
|
||||
// exit;
|
||||
//}
|
||||
|
||||
return $connect_id;
|
||||
//return $config['dbconnection'];
|
||||
}
|
||||
|
||||
function mysql_db_get_all_rows_sql ($sql, $search_history_db = false, $cache = true) {
|
||||
|
@ -50,13 +66,13 @@ function mysql_db_get_all_rows_sql ($sql, $search_history_db = false, $cache = t
|
|||
$cache = $config["dbcache"];
|
||||
|
||||
// Read from the history DB if necessary
|
||||
if ($search_history_db) {
|
||||
if ($search_history_db) {
|
||||
$cache = false;
|
||||
$history = false;
|
||||
|
||||
if (isset($config['history_db_connection']))
|
||||
$history = mysql_db_process_sql ($sql, 'affected_rows', $config['history_db_connection'], false);
|
||||
|
||||
|
||||
if ($history === false) {
|
||||
$history = array ();
|
||||
}
|
||||
|
@ -266,10 +282,10 @@ function mysql_db_process_sql($sql, $rettype = "affected_rows", $dbconnection =
|
|||
}
|
||||
else {
|
||||
$start = microtime (true);
|
||||
if ($dbconnection == '') {
|
||||
if ($dbconnection == '') {
|
||||
$result = mysql_query ($sql);
|
||||
}
|
||||
else {
|
||||
else {
|
||||
$result = mysql_query ($sql, $dbconnection);
|
||||
}
|
||||
$time = microtime (true) - $start;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
function oracle_connect_db($host = null, $db = null, $user = null, $pass = null) {
|
||||
function oracle_connect_db($host = null, $db = null, $user = null, $pass = null, $history = null) {
|
||||
global $config;
|
||||
|
||||
if ($host === null)
|
||||
|
@ -28,18 +28,18 @@ function oracle_connect_db($host = null, $db = null, $user = null, $pass = null)
|
|||
|
||||
// Non-persistent connection: This will help to avoid mysql errors like "has gone away" or locking problems
|
||||
// If you want persistent connections change it to oci_pconnect().
|
||||
$config['dbconnection'] = oci_connect($user, $pass, '//' . $host . '/' . $db);
|
||||
$connect_id = oci_connect($user, $pass, '//' . $host . '/' . $db);
|
||||
|
||||
if (! $config['dbconnection']) {
|
||||
if (! $connect_id) {
|
||||
include ($config["homedir"]."/general/error_authconfig.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
// Set date and timestamp formats for this session
|
||||
$datetime_tz_format = oci_parse($config['dbconnection'] , 'alter session set NLS_TIMESTAMP_TZ_FORMAT =\'YYYY-MM-DD HH24:MI:SS\'');
|
||||
$datetime_format = oci_parse($config['dbconnection'] , 'alter session set NLS_TIMESTAMP_FORMAT =\'YYYY-MM-DD HH24:MI:SS\'');
|
||||
$date_format = oci_parse($config['dbconnection'] , 'alter session set NLS_DATE_FORMAT =\'YYYY-MM-DD HH24:MI:SS\'');
|
||||
$decimal_separator = oci_parse($config['dbconnection'] , 'alter session set NLS_NUMERIC_CHARACTERS =\',.\'');
|
||||
$datetime_tz_format = oci_parse($connect_id , 'alter session set NLS_TIMESTAMP_TZ_FORMAT =\'YYYY-MM-DD HH24:MI:SS\'');
|
||||
$datetime_format = oci_parse($connect_id , 'alter session set NLS_TIMESTAMP_FORMAT =\'YYYY-MM-DD HH24:MI:SS\'');
|
||||
$date_format = oci_parse($connect_id , 'alter session set NLS_DATE_FORMAT =\'YYYY-MM-DD HH24:MI:SS\'');
|
||||
$decimal_separator = oci_parse($connect_id , 'alter session set NLS_NUMERIC_CHARACTERS =\',.\'');
|
||||
|
||||
oci_execute($datetime_tz_format);
|
||||
oci_execute($datetime_format);
|
||||
|
@ -51,7 +51,14 @@ function oracle_connect_db($host = null, $db = null, $user = null, $pass = null)
|
|||
oci_free_statement($date_format);
|
||||
oci_free_statement($decimal_separator);
|
||||
|
||||
return $config['dbconnection'];
|
||||
if ($history){
|
||||
$config['history_db_dbconnection'] = $connect_id;
|
||||
}
|
||||
else{
|
||||
$config['dbconnection'] = $connect_id;
|
||||
}
|
||||
|
||||
return $connect_id;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
function postgresql_connect_db($host = null, $db = null, $user = null, $pass = null) {
|
||||
function postgresql_connect_db($host = null, $db = null, $user = null, $pass = null, $history = null) {
|
||||
global $config;
|
||||
|
||||
if ($host === null)
|
||||
|
@ -26,17 +26,24 @@ function postgresql_connect_db($host = null, $db = null, $user = null, $pass = n
|
|||
if ($pass === null)
|
||||
$pass = $config["dbpass"];
|
||||
|
||||
$config['dbconnection'] = pg_connect("host='" . $host . "'" .
|
||||
$connect_id = pg_connect("host='" . $host . "'" .
|
||||
" dbname='" . $db . "'" .
|
||||
" user='" . $user . "'" .
|
||||
" password='" . $pass . "'");
|
||||
|
||||
if (! $config['dbconnection']) {
|
||||
if (! $connect_id) {
|
||||
include ($config["homedir"]."/general/error_authconfig.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
return $config['dbconnection'];
|
||||
if ($history){
|
||||
$config['history_db_dbconnection'] = $connect_id;
|
||||
}
|
||||
else{
|
||||
$config['dbconnection'] = $connect_id;
|
||||
}
|
||||
|
||||
return $connect_id;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1034,4 +1041,4 @@ function postgresql_db_get_type_field_table($table, $field) {
|
|||
|
||||
return pg_field_type($result, $field);
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -42,18 +42,18 @@ function db_select_engine() {
|
|||
}
|
||||
}
|
||||
|
||||
function db_connect($host = null, $db = null, $user = null, $pass = null) {
|
||||
function db_connect($host = null, $db = null, $user = null, $pass = null, $history = null) {
|
||||
global $config;
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
return mysql_connect_db($host, $db, $user, $pass);
|
||||
case "mysql":
|
||||
return mysql_connect_db($host, $db, $user, $pass, $history);
|
||||
break;
|
||||
case "postgresql":
|
||||
return postgresql_connect_db($host, $db, $user, $pass);
|
||||
return postgresql_connect_db($host, $db, $user, $pass, $history);
|
||||
break;
|
||||
case "oracle":
|
||||
return oracle_connect_db($host, $db, $user, $pass);
|
||||
return oracle_connect_db($host, $db, $user, $pass, $history);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ if (! check_acl ($config['id_user'], $group, "AR") || $module_id == 0) {
|
|||
|
||||
$table->cellpadding = 3;
|
||||
$table->cellspacing = 3;
|
||||
$table->width = 600;
|
||||
$table->width = '98%';
|
||||
$table->class = "databox";
|
||||
$table->head = array ();
|
||||
$table->data = array ();
|
||||
|
@ -148,7 +148,7 @@ if (($config['dbtype'] == 'oracle') && ($result !== false)) {
|
|||
|
||||
$header_title = __('Received data from')." ".modules_get_agentmodule_agent_name ($module_id)." / ".modules_get_agentmodule_name ($module_id);
|
||||
|
||||
echo "<h3>".$header_title. "</h3>";
|
||||
echo "<h4>".$header_title. "</h4>";
|
||||
|
||||
$intervals = array ();
|
||||
$intervals[3600] = human_time_description_raw (3600); // 1 hour
|
||||
|
@ -235,6 +235,7 @@ $(document).ready (function () {
|
|||
spinnerSize: [20, 20, 0]
|
||||
});
|
||||
$("#text-date_from, #text-date_to").datepicker ();
|
||||
$.datepicker.regional["<?php echo $config['language']; ?>"];
|
||||
$.datepicker.regional["<?php echo $config['language']; ?>"];
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Reference in New Issue