diff options
author | alex <alex@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-10-27 14:38:55 +0000 |
---|---|---|
committer | alex <alex@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-10-27 14:38:55 +0000 |
commit | 7b7976989a763fcc53b7a15d7ae6c6957a464e0f (patch) | |
tree | 47a6148f48981a1ae2590edd8b00b53311bab679 | |
parent | aff91902c52d3532bcf8616261a7b4f209a8d6c7 (diff) | |
download | zabbix-7b7976989a763fcc53b7a15d7ae6c6957a464e0f.tar.gz zabbix-7b7976989a763fcc53b7a15d7ae6c6957a464e0f.tar.xz zabbix-7b7976989a763fcc53b7a15d7ae6c6957a464e0f.zip |
- fixed occasional LIBSQLORA8-30002: Memory allocation error. (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@3394 97f52cf1-0a1b-0410-bd0e-c28be96e8082
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | frontends/php/include/db.inc.php | 17 | ||||
-rw-r--r-- | src/libs/zbxdbhigh/db.c | 15 |
3 files changed, 25 insertions, 8 deletions
@@ -12,6 +12,7 @@ Changes for 1.3: Integrated from 1.1.x + - fixed occasional LIBSQLORA8-30002: Memory allocation error. (Alexei) - fixed system.swap.in[] and system.swap.out[] under Linux 2.4 (Alexei) - fixed processing of SNMP HEX and OCTET string values (Alexei) - added Dutch tranlation (Alexei) diff --git a/frontends/php/include/db.inc.php b/frontends/php/include/db.inc.php index 0304d867..74a003d8 100644 --- a/frontends/php/include/db.inc.php +++ b/frontends/php/include/db.inc.php @@ -246,30 +246,37 @@ COpt::savesqlrequest($query); } } -/* - function DBinsert_id($result,$table,$field) + function DBinsert_id($result,$table,$field) { - global $DB,$DB_TYPE; + global $DB,$DB_TYPE; if($DB_TYPE == "MYSQL") { return mysql_insert_id($DB); } - + if($DB_TYPE == "POSTGRESQL") { $oid=pg_getlastoid($result); +// echo "OID:$oid<br>"; $sql="select $field from $table where oid=$oid"; $result=DBselect($sql); return get_field($result,0,0); } if($DB_TYPE == "ORACLE") { +/* $sql="select max($field) from $table"; + $parse=DBexecute($sql); + while(OCIFetch($parse)) + { + $colvalue = OCIResult($parse, 1); + return $colvalue; + } +*/ $res = DBfetch(DBselect('select '.$table.'_'.$field.'.currval from dual')); return $res[0]; } } -*/ /* string value prepearing */ if($DB_TYPE == "ORACLE") { diff --git a/src/libs/zbxdbhigh/db.c b/src/libs/zbxdbhigh/db.c index 657834ff..6b49a490 100644 --- a/src/libs/zbxdbhigh/db.c +++ b/src/libs/zbxdbhigh/db.c @@ -561,15 +561,24 @@ int DBinsert_id(int exec_result, const char *table, const char *field) #ifdef HAVE_ORACLE DB_ROW row; + char sql[MAX_STRING_LEN]; + DB_RESULT result; + int id; zabbix_log(LOG_LEVEL_DEBUG, "In DBinsert_id()" ); if(exec_result == FAIL) return 0; - - row = DBfetch(DBselect("select %s_%s.currval from dual", table, field)); - return atoi(row[0]); + zbx_snprintf(sql, sizeof(sql), "select %s_%s.currval from dual", table, field); + + resulr=DBselect(sql); + row = DBfetch(result); + + id = atoi(row[0]); + DBfree_result(result); + + return id; #endif } |