Error fixes related with the improved oracle compatibility

This commit is contained in:
Alejandro Gallardo Escobar 2015-05-04 20:11:03 +02:00
parent 7ae97fa48b
commit c02f3bacf4
3 changed files with 32 additions and 9 deletions

View File

@ -372,16 +372,35 @@ if(!empty($groups)) {
AND tam.id_agente_modulo = $module_id
AND tpda.all_modules = 1))";
}
switch ($config["dbtype"]) {
case "mysql":
case "postgresql":
$sql = "SELECT *
FROM tplanned_downtime
WHERE $where_values
ORDER BY type_execution DESC, date_from DESC
LIMIT ".$config["block_size"]."
OFFSET $offset";
break;
case "oracle":
$set = array ();
$set['limit'] = $config["block_size"];
$set['offset'] = $offset;
$sql = "SELECT *
FROM tplanned_downtime
WHERE $where_values
ORDER BY type_execution DESC, date_from DESC";
$sql = oracle_recode_query ($sql, $set);
break;
}
$sql = "SELECT *
FROM tplanned_downtime
WHERE $where_values
ORDER BY type_execution DESC, date_from DESC
LIMIT ".$config["block_size"]."
OFFSET $offset";
$sql_count = "SELECT COUNT(id) AS num
FROM tplanned_downtime
WHERE $where_values";
$downtimes = db_get_all_rows_sql ($sql);
$downtimes_number_res = db_get_all_rows_sql($sql_count);
$downtimes_number = $downtimes_number_res != false ? $downtimes_number_res[0]['num'] : 0;

View File

@ -99,7 +99,7 @@ if ($search_agents && ((!defined('METACONSOLE')) || $force_local)) {
$filter_agents[] = '(nombre LIKE \'%'.$string.'%\')';
break;
case "oracle":
$filter_agents[] = '(UPPER(nombre) LIKE UPPER(\'%'.$string.'%\')';
$filter_agents[] = '(UPPER(nombre) LIKE UPPER(\'%'.$string.'%\'))';
break;
}
$agents = agents_get_agents($filter_agents, array ('id_agente', 'nombre', 'direccion'));

View File

@ -2086,11 +2086,15 @@ function visual_map_create_internal_name_item($label = null, $type, $image, $age
}
function visual_map_get_items_parents($idVisual) {
$items = db_get_all_rows_sql(sprintf("SELECT * FROM tlayout_data where id_layout = %s order by label",$idVisual));
//$items = db_get_all_fields_in_table('tlayout_data',array('id_layout' => $idVisual));
// Avoid the sort by 'label' in the query cause oracle cannot sort by columns with CLOB type
$items = db_get_all_rows_filter('tlayout_data', array('id_layout' => $idVisual));
if ($items == false) {
$items = array();
}
else {
// Sort by label
sort_by_column($items, 'label');
}
$return = array();
foreach ($items as $item) {