diff options
| author | alex <alex@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-11-15 18:00:56 +0000 |
|---|---|---|
| committer | alex <alex@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-11-15 18:00:56 +0000 |
| commit | ee2f224a93faee1cf04b1eae03e610d438216ce7 (patch) | |
| tree | f8503c81016337f8c5782d84e2fe4bade7b96453 /src/libs | |
| parent | 941c0734ac24a6719828edd24010f08e43ae4ef7 (diff) | |
| download | zabbix-ee2f224a93faee1cf04b1eae03e610d438216ce7.tar.gz zabbix-ee2f224a93faee1cf04b1eae03e610d438216ce7.tar.xz zabbix-ee2f224a93faee1cf04b1eae03e610d438216ce7.zip | |
More support of sqlite.
git-svn-id: svn://svn.zabbix.com/trunk@3492 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src/libs')
| -rw-r--r-- | src/libs/zbxdbhigh/db.c | 70 |
1 files changed, 68 insertions, 2 deletions
diff --git a/src/libs/zbxdbhigh/db.c b/src/libs/zbxdbhigh/db.c index 3a79c45a..cf49a7a8 100644 --- a/src/libs/zbxdbhigh/db.c +++ b/src/libs/zbxdbhigh/db.c @@ -140,13 +140,79 @@ void DBconnect(void) /* check to see that the backend connection was successfully made */ if(res) { - zabbix_log(LOG_LEVEL_ERR, "Can't open database: %s\n", sqlite3_errmsg(sqlite)); + zabbix_log(LOG_LEVEL_ERR, "Can't open database [%s]: %s\n", CONFIG_DBNAME, sqlite3_errmsg(sqlite)); DBclose(); exit(FAIL); } #endif } +/****************************************************************************** + * * + * Function: DBbegin * + * * + * Purpose: Start transaction * + * * + * Parameters: - * + * * + * Return value: - * + * * + * Author: Alexei Vladishev * + * * + * Comments: Do nothing of DB does not support transactions * + * * + ******************************************************************************/ +void DBbegin(void) +{ +#ifdef HAVE_SQLITE3 + DBexecute("begin;"); +#endif +} + +/****************************************************************************** + * * + * Function: DBcommit * + * * + * Purpose: Commit transaction * + * * + * Parameters: - * + * * + * Return value: - * + * * + * Author: Alexei Vladishev * + * * + * Comments: Do nothing of DB does not support transactions * + * * + ******************************************************************************/ +void DBcommit(void) +{ +#ifdef HAVE_SQLITE3 + DBexecute("commit;"); +#endif +} + +/****************************************************************************** + * * + * Function: DBrllback * + * * + * Purpose: Rollback transaction * + * * + * Parameters: - * + * * + * Return value: - * + * * + * Author: Alexei Vladishev * + * * + * Comments: Do nothing of DB does not support transactions * + * * + ******************************************************************************/ +void DBrollback(void) +{ +#ifdef HAVE_SQLITE3 + DBexecute("rollback;"); +#endif +} + /* * Execute SQL statement. For non-select statements only. * If fails, program terminates. @@ -395,7 +461,7 @@ DB_RESULT DBselect(const char *fmt, ...) if(SQLITE_OK != sqlite3_prepare(sqlite, sql, -1, &stmt, 0)) { zabbix_log(LOG_LEVEL_ERR, "Query::%s",sql); - zabbix_log(LOG_LEVEL_ERR, "Query failed:%s", "Error!"); + zabbix_log(LOG_LEVEL_ERR, "Query failed:%s", sqlite3_errmsg(sqlite)); exit(FAIL); } return stmt; |
