diff options
| author | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2007-03-13 09:26:39 +0000 |
|---|---|---|
| committer | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2007-03-13 09:26:39 +0000 |
| commit | e2b4335e7a146e768ff402a61ffb4092e834b818 (patch) | |
| tree | 4b322ac29bbfa0d2dfb56aa7d5d05ce5dff4b68a /src/libs/zbxdb/db.c | |
| parent | 883163bc42892ffe0885e94b701ef9da4da3cf70 (diff) | |
| download | zabbix-e2b4335e7a146e768ff402a61ffb4092e834b818.tar.gz zabbix-e2b4335e7a146e768ff402a61ffb4092e834b818.tar.xz zabbix-e2b4335e7a146e768ff402a61ffb4092e834b818.zip | |
- fixed net-snmp compilation (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@3887 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src/libs/zbxdb/db.c')
| -rw-r--r-- | src/libs/zbxdb/db.c | 39 |
1 files changed, 15 insertions, 24 deletions
diff --git a/src/libs/zbxdb/db.c b/src/libs/zbxdb/db.c index b0631f87..2799cdce 100644 --- a/src/libs/zbxdb/db.c +++ b/src/libs/zbxdb/db.c @@ -17,21 +17,12 @@ ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. **/ +#include "common.h" -#include <stdlib.h> -#include <stdio.h> - -/* for setproctitle() */ -#include <sys/types.h> -#include <unistd.h> - -#include <string.h> -#include <strings.h> - +#include "db.h" #include "zbxdb.h" #include "log.h" #include "zlog.h" -#include "common.h" #ifdef HAVE_SQLITE3 int sqlite_transaction_started = 0; @@ -163,16 +154,16 @@ int zbx_db_connect(char *host, char *user, char *password, char *dbname, char *d exit(FAIL); } sqlo_autocommit_on(oracle); + + return ret #endif #ifdef HAVE_SQLITE3 - int res; - - res = sqlite3_open(name, &conn); + ret = sqlite3_open(dbname, &conn); /* check to see that the backend connection was successfully made */ - if(res) + if(ret) { - zabbix_log(LOG_LEVEL_ERR, "Can't open database [%s]: %s\n", name, sqlite3_errmsg(conn)); + zabbix_log(LOG_LEVEL_ERR, "Can't open database [%s]: %s\n", dbname, sqlite3_errmsg(conn)); DBclose(); exit(FAIL); } @@ -180,13 +171,15 @@ int zbx_db_connect(char *host, char *user, char *password, char *dbname, char *d /* Do not return SQLITE_BUSY immediately, wait for N ms */ sqlite3_busy_timeout(conn, 60*1000); - if(ZBX_MUTEX_ERROR == php_sem_get(&sqlite_access, name)) + if(ZBX_MUTEX_ERROR == php_sem_get(&sqlite_access, dbname)) { zbx_error("Unable to create mutex for sqlite"); exit(FAIL); } sqlite_transaction_started = 0; + + return ret; #endif } @@ -550,16 +543,14 @@ DB_ROW zbx_db_fetch(DB_RESULT result) } else if(SQLO_NO_DATA == res) { - return 0; - } - else - { - zabbix_log( LOG_LEVEL_ERR, "Fetch failed:%s\n", sqlo_geterror(oracle) ); - exit(FAIL); + return NULL; } + + zabbix_log( LOG_LEVEL_ERR, "Fetch failed:%s\n", sqlo_geterror(oracle) ); + exit(FAIL); + return NULL; #endif #ifdef HAVE_SQLITE3 - int i; /* EOF */ if(!result) return NULL; |
