summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rw-r--r--configure.ac5
-rw-r--r--plugins/omlibdbi/omlibdbi.c12
3 files changed, 17 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 2ef0aaa3..ffc00891 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,7 @@ Version 7.3.9 [devel] 2013-03-??
- bugfix: imudp scheduling parameters did affect main thread, not imudp
closes: http://bugzilla.adiscon.com/show_bug.cgi?id=409
- omlibdbi: now supports transaction interface
+ if recent enough lbdbi is present
- imuxsock: add ability to NOT create/delete sockets during startup and
shutdown
closes: http://bugzilla.adiscon.com/show_bug.cgi?id=259
diff --git a/configure.ac b/configure.ac
index a6d1b8e7..671e6442 100644
--- a/configure.ac
+++ b/configure.ac
@@ -660,6 +660,11 @@ if test "x$enable_libdbi" = "xyes"; then
[dbi_initialize_r],
[AC_DEFINE([HAVE_DBI_R], [1], [Define to 1 if libdbi supports the new plugin-safe interface])]
)
+ AC_CHECK_LIB(
+ [dbi],
+ [dbi_conn_transaction_begin],
+ [AC_DEFINE([HAVE_DBI_TXSUPP], [1], [Define to 1 if libdbi supports transactions])]
+ )
fi
AM_CONDITIONAL(ENABLE_OMLIBDBI, test x$enable_libdbi = xyes)
AC_SUBST(LIBDBI_CFLAGS)
diff --git a/plugins/omlibdbi/omlibdbi.c b/plugins/omlibdbi/omlibdbi.c
index 9e8cb913..6e27ad22 100644
--- a/plugins/omlibdbi/omlibdbi.c
+++ b/plugins/omlibdbi/omlibdbi.c
@@ -337,12 +337,14 @@ CODESTARTbeginTransaction
if(pData->conn == NULL) {
CHKiRet(initConn(pData, 0));
}
+# if HAVE_DBI_TXSUPP
if (pData->txSupport == 1) {
if (dbi_conn_transaction_begin(pData->conn) != 0) {
dbgprintf("libdbi server error: begin transaction not successful\n");
iRet = RS_RET_SUSPENDED;
- }
+ }
}
+# endif
finalize_it:
ENDbeginTransaction
/* end transaction */
@@ -350,19 +352,23 @@ ENDbeginTransaction
BEGINdoAction
CODESTARTdoAction
CHKiRet(writeDB(ppString[0], pData));
+# if HAVE_DBI_TXSUPP
if (pData->txSupport == 1) {
iRet = RS_RET_DEFER_COMMIT;
}
+# endif
finalize_it:
ENDdoAction
/* transaction support 2013-03 */
BEGINendTransaction
CODESTARTendTransaction
+# if HAVE_DBI_TXSUPP
if (dbi_conn_transaction_commit(pData->conn) != 0) {
dbgprintf("libdbi server error: transaction not committed\n");
iRet = RS_RET_SUSPENDED;
}
+# endif
ENDendTransaction
/* end transaction */
@@ -571,6 +577,10 @@ CODESTARTmodInit
INITLegCnfVars
*ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */
CODEmodInit_QueryRegCFSLineHdlr
+# ifndef HAVE_DBI_TXSUPP
+ DBGPRINTF("omlibdbi: no transaction support in libdbi\n");
+# warning libdbi too old - transactions are not enabled (use 0.9 or later)
+# endif
CHKiRet(objUse(errmsg, CORE_COMPONENT));
CHKiRet(regCfSysLineHdlr2((uchar *)"actionlibdbidriverdirectory", 0, eCmdHdlrGetWord, NULL, &cs.dbiDrvrDir, STD_LOADABLE_MODULE_ID, &bLegacyCnfModGlobalsPermitted));
CHKiRet(omsdRegCFSLineHdlr((uchar *)"actionlibdbidriver", 0, eCmdHdlrGetWord, NULL, &cs.drvrName, STD_LOADABLE_MODULE_ID));