summaryrefslogtreecommitdiffstats
path: root/frontends/php/include/db.inc.php
diff options
context:
space:
mode:
authorartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-04-17 15:02:02 +0000
committerartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-04-17 15:02:02 +0000
commitb82812f00576369e65c996ef51264de66ce63d57 (patch)
treea3ba8c407e03edd1905f591aa2d14bf32acc4f9b /frontends/php/include/db.inc.php
parentcd6be85dfcfccb202f2d2a9ca9db062725e45d5c (diff)
downloadzabbix-b82812f00576369e65c996ef51264de66ce63d57.tar.gz
zabbix-b82812f00576369e65c996ef51264de66ce63d57.tar.xz
zabbix-b82812f00576369e65c996ef51264de66ce63d57.zip
- [DEV-137] fixes in graph zoom for KQ (Artem)
- [DEV-137] fixes for possible errors under Oracle (Artem) git-svn-id: svn://svn.zabbix.com/trunk@5632 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/db.inc.php')
-rw-r--r--frontends/php/include/db.inc.php34
1 files changed, 15 insertions, 19 deletions
diff --git a/frontends/php/include/db.inc.php b/frontends/php/include/db.inc.php
index df9bd6bf..defaad6a 100644
--- a/frontends/php/include/db.inc.php
+++ b/frontends/php/include/db.inc.php
@@ -487,23 +487,12 @@
$result = pg_fetch_assoc($cursor);
break;
case "ORACLE":
- $text_datatypes = array('VARCHAR','VARCHAR2','CLOB','BLOB');
- if(ocifetchinto($cursor, $row, OCI_ASSOC+OCI_RETURN_NULLS))
- {
+ if(ocifetchinto($cursor, $row, (OCI_ASSOC+OCI_RETURN_NULLS))){
$result = array();
- $keys = (array_keys($row));
- foreach ($keys as $k)
- {
- $field = is_int($k) ? $k + 1 : $k;
- $column_type = ocicolumntype($cursor, $field);
- $field_is_null = ocicolumnisnull($cursor, $field);
-
- if ($field_is_null && str_in_array($column_type,$text_datatypes))
- $result[strtolower($k)] = '';
- else
- $result[strtolower($k)] = $row[$k];
+ foreach($row as $key => $value){
+ $result[strtolower($key)] = (str_in_array(strtolower(ocicolumntype($cursor,$key)),array('varchar','varchar2','blob','clob')) && is_null($value))?'':$value;
}
- }
+ }
break;
case "SQLITE3":
if($cursor){
@@ -721,16 +710,22 @@ else {
return bcmod($id,'100000000000');
}
- function DBin_condition($fieldname, &$array){
+ function DBcondition($fieldname, &$array, $notin=false){
global $DB;
$condition = '';
-
+
+ $in = $notin?' NOT IN ':' IN ';
+ $concat = $notin?' AND ':' OR ';
+
switch($DB['TYPE']) {
case 'ORACLE':
$items = array_chunk($array, 1000);
foreach($items as $id => $value){
- $condition.=!empty($condition)?') OR '.$fieldname.' IN (':'';
+ if($notin)
+ $condition.=!empty($condition)?')'.$concat.$fieldname.$in.'(':'';
+ else
+ $condition.=!empty($condition)?')'.$concat.$fieldname.$in.'(':'';
$condition.= implode(',',$value);
}
break;
@@ -740,6 +735,7 @@ else {
if(empty($condition)) $condition = '0';
- return '('.$fieldname.' IN ('.$condition.'))';
+ return '('.$fieldname.$in.'('.$condition.'))';
}
+
?>