From e2ff3d0e857334cde09eb5ffd2c2a6cc9fef7bd5 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 21 Mar 2013 17:06:35 +0100 Subject: 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. --- plugins/omlibdbi/omlibdbi.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'plugins/omlibdbi/omlibdbi.c') 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)); -- cgit v1.2.3