diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2013-03-21 17:06:35 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2013-03-21 17:06:35 +0100 |
commit | e2ff3d0e857334cde09eb5ffd2c2a6cc9fef7bd5 (patch) | |
tree | 104ddbc6cf37285a32a9aeb6ed46258a3097c360 /plugins/omlibdbi/omlibdbi.c | |
parent | a6597b3ece1145876e0ac949e0df1033625b1b1f (diff) | |
download | rsyslog-e2ff3d0e857334cde09eb5ffd2c2a6cc9fef7bd5.tar.gz rsyslog-e2ff3d0e857334cde09eb5ffd2c2a6cc9fef7bd5.tar.bz2 rsyslog-e2ff3d0e857334cde09eb5ffd2c2a6cc9fef7bd5.zip |
keep omlibdbi usable with older libdbi without transaction support
in that case, omlibdbi gracefully degrades to non-transaction mode
but emits a warning message during build, so that one knows an
update of libdbi makes sense.
Diffstat (limited to 'plugins/omlibdbi/omlibdbi.c')
-rw-r--r-- | plugins/omlibdbi/omlibdbi.c | 12 |
1 files changed, 11 insertions, 1 deletions
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)); |