applied patch from Michael Biebl to auto-detect new libdbi version

This commit is contained in:
Rainer Gerhards 2008-02-18 09:59:33 +00:00
parent 1227440714
commit 069c1d2b6f
3 changed files with 11 additions and 9 deletions

View File

@ -6,6 +6,8 @@ Version 3.11.3 (rgerhards), 2008-02-??
- added support for better plugin handling in libdbi (we contributed - added support for better plugin handling in libdbi (we contributed
a patch to do that, we just now need to wait for the next libdbi a patch to do that, we just now need to wait for the next libdbi
version) version)
- bugfix: fixed abort when invalid template was provided to an action
bug http://bugzilla.adiscon.com/show_bug.cgi?id=4
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Version 3.11.2 (rgerhards), 2008-02-15 Version 3.11.2 (rgerhards), 2008-02-15
- added the capability to monitor text files and process their content - added the capability to monitor text files and process their content

View File

@ -402,6 +402,11 @@ if test "x$enable_libdbi" = "xyes"; then
], ],
[AC_MSG_FAILURE([libdbi library is missing])] [AC_MSG_FAILURE([libdbi library is missing])]
) )
AC_CHECK_LIB(
[dbi],
[dbi_initialize_r],
[AC_DEFINE([HAVE_DBI_R], [1], [Define to 1 if libdbi supports the new plugin-safe interface])]
)
fi fi
AM_CONDITIONAL(ENABLE_OMLIBDBI, test x$enable_libdbi = xyes) AM_CONDITIONAL(ENABLE_OMLIBDBI, test x$enable_libdbi = xyes)
AC_SUBST(libdbi_cflags) AC_SUBST(libdbi_cflags)

View File

@ -48,11 +48,6 @@
#include "module-template.h" #include "module-template.h"
#include "debug.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 MODULE_TYPE_OUTPUT
/* internal structures /* internal structures
@ -78,7 +73,7 @@ static uchar *host = NULL; /* host to connect to */
static uchar *usrName = NULL; /* user name for connect */ static uchar *usrName = NULL; /* user name for connect */
static uchar *pwd = NULL; /* password for connect */ static uchar *pwd = NULL; /* password for connect */
static uchar *dbName = NULL; /* database to use */ static uchar *dbName = NULL; /* database to use */
#if USE_DBI_R_CALLS == 1 #ifdef HAVE_DBI_R
static dbi_inst dbiInst; static dbi_inst dbiInst;
#endif #endif
@ -169,7 +164,7 @@ static rsRetVal initConn(instanceData *pData, int bSilent)
if(bDbiInitialized == 0) { if(bDbiInitialized == 0) {
/* we need to init libdbi first */ /* we need to init libdbi first */
# if USE_DBI_R_CALLS == 1 # ifdef HAVE_DBI_R
iDrvrsLoaded = dbi_initialize_r((char*) dbiDrvrDir, &dbiInst); iDrvrsLoaded = dbi_initialize_r((char*) dbiDrvrDir, &dbiInst);
# else # else
iDrvrsLoaded = dbi_initialize((char*) dbiDrvrDir); iDrvrsLoaded = dbi_initialize((char*) dbiDrvrDir);
@ -184,7 +179,7 @@ static rsRetVal initConn(instanceData *pData, int bSilent)
bDbiInitialized = 1; /* we are done for the rest of our existence... */ bDbiInitialized = 1; /* we are done for the rest of our existence... */
} }
# if USE_DBI_R_CALLS == 1 # ifdef HAVE_DBI_R
pData->conn = dbi_conn_new_r((char*)pData->drvrName, dbiInst); pData->conn = dbi_conn_new_r((char*)pData->drvrName, dbiInst);
# else # else
pData->conn = dbi_conn_new((char*)pData->drvrName); pData->conn = dbi_conn_new((char*)pData->drvrName);
@ -307,7 +302,7 @@ BEGINmodExit
CODESTARTmodExit CODESTARTmodExit
/* if we initialized libdbi, we now need to cleanup */ /* if we initialized libdbi, we now need to cleanup */
if(bDbiInitialized) { if(bDbiInitialized) {
# if USE_DBI_R_CALLS == 1 # ifdef HAVE_DBI_R
dbi_shutdown_r(dbiInst); dbi_shutdown_r(dbiInst);
# else # else
dbi_shutdown(); dbi_shutdown();