2011-05-13 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/functions_servers.php include/functions_agents.php operation/agentes/estado_agente.php: Fixed bad queries for console over Oracle DBMS. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4349 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
bbb44a7f33
commit
2b18e2ff02
|
@ -1,3 +1,10 @@
|
||||||
|
2011-05-13 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
|
||||||
|
|
||||||
|
* include/functions_servers.php
|
||||||
|
include/functions_agents.php
|
||||||
|
operation/agentes/estado_agente.php: Fixed bad queries for console over
|
||||||
|
Oracle DBMS.
|
||||||
|
|
||||||
2011-05-12 Miguel de Dios <miguel.dedios@artica.es>
|
2011-05-12 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
* godmode/users/configure_user.php: fixed the old call to function
|
* godmode/users/configure_user.php: fixed the old call to function
|
||||||
|
|
|
@ -1377,10 +1377,10 @@ function agents_get_status($id_agent = 0) {
|
||||||
'ceil(date_part(\'epoch\', ultimo_contacto)) + intervalo * 2 > '.$time));
|
'ceil(date_part(\'epoch\', ultimo_contacto)) + intervalo * 2 > '.$time));
|
||||||
break;
|
break;
|
||||||
case "oracle":
|
case "oracle":
|
||||||
$status = db_get_value_filter ('COUNT(*)',
|
$status = db_get_value_filter ('count(*)',
|
||||||
'tagente',
|
'tagente',
|
||||||
array ('id_agente' => (int) $id_agent,
|
array ('id_agente' => (int) $id_agent,
|
||||||
'ceil((to_date(ultimo_contacto, \'DD/MM/YYYY HH24:MI:SS\') - to_date(\'19700101000000\',\'YYYYMMDDHH24MISS\')) * (86400)) > ' . $time));
|
'ceil((to_date(ultimo_contacto, \'YYYY-MM-DD HH24:MI:SS\') - to_date(\'19700101000000\',\'YYYYMMDDHH24MISS\')) * (86400)) > ' . $time));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -352,7 +352,7 @@ function servers_get_info ($id_server = -1) {
|
||||||
case "oracle":
|
case "oracle":
|
||||||
$server["lag"] = db_get_sql ("SELECT ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (86400)) - utimestamp from trecon_task WHERE ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (86400)) > (utimestamp + interval_sweep) AND id_recon_server = ".$server["id_server"]);
|
$server["lag"] = db_get_sql ("SELECT ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (86400)) - utimestamp from trecon_task WHERE ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (86400)) > (utimestamp + interval_sweep) AND id_recon_server = ".$server["id_server"]);
|
||||||
|
|
||||||
$server["module_lag"] = db_get_sql ("SELECT COUNT(id_rt) FROM trecon_task WHERE ceil(date_part('epoch', CURRENT_TIMESTAMP)) > (utimestamp + interval_sweep) AND id_recon_server = ".$server["id_server"]);
|
$server["module_lag"] = db_get_sql ("SELECT COUNT(id_rt) FROM trecon_task WHERE ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (86400)) > (utimestamp + interval_sweep) AND id_recon_server = ".$server["id_server"]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} // recon
|
} // recon
|
||||||
|
|
|
@ -271,12 +271,35 @@ if (! empty ($agent_names)) {
|
||||||
$sql = sprintf ('SELECT COUNT(*) FROM tagente WHERE 1=1 %s %s', $search_sql, $subquery_enterprise);
|
$sql = sprintf ('SELECT COUNT(*) FROM tagente WHERE 1=1 %s %s', $search_sql, $subquery_enterprise);
|
||||||
$total_agents = db_get_sql ($sql);
|
$total_agents = db_get_sql ($sql);
|
||||||
|
|
||||||
|
switch ($config["dbtype"]) {
|
||||||
|
case "mysql":
|
||||||
|
case "postgresql":
|
||||||
$sql = sprintf ('SELECT * FROM tagente
|
$sql = sprintf ('SELECT * FROM tagente
|
||||||
WHERE 1=1 %s %s
|
WHERE 1=1 %s %s
|
||||||
ORDER BY %s %s LIMIT %d, %d', $search_sql, $subquery_enterprise,
|
ORDER BY %s %s LIMIT %d, %d', $search_sql, $subquery_enterprise,
|
||||||
$order['field'], $order['order'], $offset, $config["block_size"]);
|
$order['field'], $order['order'], $offset, $config["block_size"]);
|
||||||
|
break;
|
||||||
|
case "oracle":
|
||||||
|
$set = array ();
|
||||||
|
$set['limit'] = $config["block_size"];
|
||||||
|
$set['offset'] = $offset;
|
||||||
|
$sql = sprintf ('SELECT * FROM tagente
|
||||||
|
WHERE 1=1 %s %s
|
||||||
|
ORDER BY %s %s', $search_sql, $subquery_enterprise,
|
||||||
|
$order['field'], $order['order']);
|
||||||
|
$sql = oracle_recode_query ($sql, $set);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$agents = db_get_all_rows_sql ($sql);
|
$agents = db_get_all_rows_sql ($sql);
|
||||||
|
|
||||||
|
// Delete rnum row generated by oracle_recode_query() function
|
||||||
|
if (($config['dbtype'] == 'oracle') && ($agents !== false)) {
|
||||||
|
for ($i=0; $i < count($agents); $i++) {
|
||||||
|
unset($agents[$i]['rnum']);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$total_agents = agents_get_agents(array ('id_agente' => array_keys ($agent_names),
|
$total_agents = agents_get_agents(array ('id_agente' => array_keys ($agent_names),
|
||||||
|
|
Loading…
Reference in New Issue