mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
Fixed network components when search in db engine Oracle
This commit is contained in:
parent
ec9a52337d
commit
28e1f0a7c0
@ -516,10 +516,10 @@ $filter = array ();
|
|||||||
if ($search_id_group)
|
if ($search_id_group)
|
||||||
$filter['id_group'] = $search_id_group;
|
$filter['id_group'] = $search_id_group;
|
||||||
if ($search_string != '')
|
if ($search_string != '')
|
||||||
$filter[] = '(name LIKE "%' . $search_string . '%" ' .
|
$filter[] = '(name LIKE ' . "'%" . $search_string . "%'" .
|
||||||
'OR description LIKE "%'. $search_string . '%" ' .
|
'OR description LIKE ' . "'%". $search_string . "%'" .
|
||||||
'OR tcp_send LIKE "%' . $search_string . '%" ' .
|
'OR tcp_send LIKE ' . "'%" . $search_string . "%'" .
|
||||||
'OR tcp_rcv LIKE "%' . $search_string . '%")';
|
'OR tcp_rcv LIKE ' . "'%" . $search_string . "%'" . ')';
|
||||||
|
|
||||||
$total_components = network_components_get_network_components (false, $filter, 'COUNT(*) AS total');
|
$total_components = network_components_get_network_components (false, $filter, 'COUNT(*) AS total');
|
||||||
$total_components = $total_components[0]['total'];
|
$total_components = $total_components[0]['total'];
|
||||||
|
@ -123,31 +123,50 @@ function network_components_get_network_components ($id_module, $filter = false,
|
|||||||
$filter = array ();
|
$filter = array ();
|
||||||
if (! empty ($id_module))
|
if (! empty ($id_module))
|
||||||
$filter['id_modulo'] = (int) $id_module;
|
$filter['id_modulo'] = (int) $id_module;
|
||||||
|
if (isset($filter['offset'])) {
|
||||||
|
$offset = $filter['offset'];
|
||||||
|
unset($filter['offset']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($filter['limit'])) {
|
||||||
|
$limit = $filter['limit'];
|
||||||
|
unset($filter['limit']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = @db_get_all_rows_filter ('tnetwork_component', $filter, $fields, 'AND', false, true);
|
||||||
|
|
||||||
switch ($config["dbtype"]) {
|
switch ($config["dbtype"]) {
|
||||||
case "mysql":
|
case "mysql":
|
||||||
|
$limit_sql = '';
|
||||||
|
if (isset($offset) && isset($limit)) {
|
||||||
|
$limit_sql = " LIMIT $offset, $limit ";
|
||||||
|
}
|
||||||
|
$sql = sprintf("%s %s", $sql, $limit_sql);
|
||||||
|
|
||||||
|
$components = db_get_all_rows_sql($sql);
|
||||||
|
break;
|
||||||
case "postgresql":
|
case "postgresql":
|
||||||
$components = db_get_all_rows_filter ('tnetwork_component',
|
$limit_sql = '';
|
||||||
$filter, $fields);
|
if (isset($offset) && isset($limit)) {
|
||||||
|
$limit_sql = " OFFSET $offset LIMIT $limit ";
|
||||||
|
}
|
||||||
|
$sql = sprintf("%s %s", $sql, $limit_sql);
|
||||||
|
|
||||||
|
$components = db_get_all_rows_sql($sql);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "oracle":
|
case "oracle":
|
||||||
if (count ($fields) > 1) {
|
$set = array();
|
||||||
$fields = implode(',',$fields);
|
if (isset($offset) && isset($limit)) {
|
||||||
}
|
$set['limit'] = $limit;
|
||||||
if (isset($filter['offset'])) {
|
$set['offset'] = $offset;
|
||||||
$components = oracle_recode_query ('SELECT ' . $fields . ' FROM tnetwork_component', $filter, 'AND', false);
|
|
||||||
if ($components != false) {
|
|
||||||
for ($i=0; $i < count($components); $i++) {
|
|
||||||
unset($components[$i]['rnum']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$components = db_get_all_rows_filter ('tnetwork_component',
|
|
||||||
$filter, $fields);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$components = oracle_recode_query ($sql, $set, 'AND', false);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($components === false)
|
if ($components === false)
|
||||||
return array ();
|
return array ();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user