summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-02-16 17:36:59 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-02-16 17:36:59 +0000
commit2a1b4a45e00140c0c83799d20014161dc7b67703 (patch)
tree19cc7e4f694901f6d9be63a5e18d2362f6e83bea /plugins
parent0e1adf63dce5d7328b311bf17559338d327ba7ab (diff)
downloadrsyslog-2a1b4a45e00140c0c83799d20014161dc7b67703.tar.gz
rsyslog-2a1b4a45e00140c0c83799d20014161dc7b67703.tar.xz
rsyslog-2a1b4a45e00140c0c83799d20014161dc7b67703.zip
adopted omlibdbi to use new version of libdbi
Diffstat (limited to 'plugins')
-rw-r--r--plugins/omlibdbi/omlibdbi.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/plugins/omlibdbi/omlibdbi.c b/plugins/omlibdbi/omlibdbi.c
index 99e4d4f6..77b17310 100644
--- a/plugins/omlibdbi/omlibdbi.c
+++ b/plugins/omlibdbi/omlibdbi.c
@@ -48,6 +48,11 @@
#include "module-template.h"
#include "debug.h"
+/* this is a temporary setting to select either the old- or new-style libdbi
+ * calls. -- rgerhards, 2008-02-16
+ */
+#define USE_DBI_R_CALLS 0
+
MODULE_TYPE_OUTPUT
/* internal structures
@@ -73,6 +78,9 @@ static uchar *host = NULL; /* host to connect to */
static uchar *usrName = NULL; /* user name for connect */
static uchar *pwd = NULL; /* password for connect */
static uchar *dbName = NULL; /* database to use */
+#if USE_DBI_R_CALLS == 1
+static dbi_inst dbiInst;
+#endif
BEGINcreateInstance
@@ -161,7 +169,11 @@ static rsRetVal initConn(instanceData *pData, int bSilent)
if(bDbiInitialized == 0) {
/* we need to init libdbi first */
+# if USE_DBI_R_CALLS == 1
+ iDrvrsLoaded = dbi_initialize_r((char*) dbiDrvrDir, &dbiInst);
+# else
iDrvrsLoaded = dbi_initialize((char*) dbiDrvrDir);
+# endif
if(iDrvrsLoaded == 0) {
logerror("libdbi error: libdbi or libdbi drivers not present on this system - suspending.");
ABORT_FINALIZE(RS_RET_SUSPENDED);
@@ -172,7 +184,11 @@ static rsRetVal initConn(instanceData *pData, int bSilent)
bDbiInitialized = 1; /* we are done for the rest of our existence... */
}
+# if USE_DBI_R_CALLS == 1
+ pData->conn = dbi_conn_new_r((char*)pData->drvrName, dbiInst);
+# else
pData->conn = dbi_conn_new((char*)pData->drvrName);
+# endif
if(pData->conn == NULL) {
logerror("can not initialize libdbi connection");
iRet = RS_RET_SUSPENDED;
@@ -291,7 +307,11 @@ BEGINmodExit
CODESTARTmodExit
/* if we initialized libdbi, we now need to cleanup */
if(bDbiInitialized) {
+# if USE_DBI_R_CALLS == 1
+ dbi_shutdown_r(dbiInst);
+# else
dbi_shutdown();
+# endif
}
ENDmodExit