summaryrefslogtreecommitdiffstats
path: root/plugins/ompgsql/ompgsql.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-07-09 09:42:32 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-07-09 09:42:32 +0200
commit3e4aa167eed33a37163446feb2f28efe3e4582d5 (patch)
treeb309d9fe6ab1c33f2e9df8512cf0216e2ce86271 /plugins/ompgsql/ompgsql.c
parente2c9493b0d832078e181a6bce3373850df27d204 (diff)
parent9f286c0c4c21128c66305166ae379d3f7b07f673 (diff)
downloadrsyslog-3e4aa167eed33a37163446feb2f28efe3e4582d5.tar.gz
rsyslog-3e4aa167eed33a37163446feb2f28efe3e4582d5.tar.xz
rsyslog-3e4aa167eed33a37163446feb2f28efe3e4582d5.zip
Merge branch 'master' into udpspoof
Conflicts: tools/omfwd.c
Diffstat (limited to 'plugins/ompgsql/ompgsql.c')
-rw-r--r--plugins/ompgsql/ompgsql.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/plugins/ompgsql/ompgsql.c b/plugins/ompgsql/ompgsql.c
index 6daac1c7..cb6b6a4d 100644
--- a/plugins/ompgsql/ompgsql.c
+++ b/plugins/ompgsql/ompgsql.c
@@ -40,7 +40,7 @@
#include <errno.h>
#include <time.h>
#include <libpq-fe.h>
-#include "dirty.h"
+#include "conf.h"
#include "syslogd-types.h"
#include "srUtils.h"
#include "template.h"
@@ -170,6 +170,9 @@ tryExec(uchar *pszCmd, instanceData *pData)
int bHadError = 0;
/* try insert */
+BEGINfunc
+RUNLOG_VAR("%p", pData->f_hpgsql);
+RUNLOG_VAR("%s", pszCmd);
pgRet = PQexec(pData->f_hpgsql, (char*)pszCmd);
execState = PQresultStatus(pgRet);
if(execState != PGRES_COMMAND_OK && execState != PGRES_TUPLES_OK) {
@@ -178,6 +181,7 @@ tryExec(uchar *pszCmd, instanceData *pData)
}
PQclear(pgRet);
+ENDfunc
return(bHadError);
}
@@ -230,6 +234,14 @@ CODESTARTtryResume
}
ENDtryResume
+
+BEGINbeginTransaction
+CODESTARTbeginTransaction
+dbgprintf("ompgsql: beginTransaction\n");
+ iRet = writePgSQL((uchar*) "begin", pData); /* TODO: make user-configurable */
+ENDbeginTransaction
+
+
BEGINdoAction
CODESTARTdoAction
dbgprintf("\n");
@@ -237,6 +249,13 @@ CODESTARTdoAction
ENDdoAction
+BEGINendTransaction
+CODESTARTendTransaction
+ iRet = writePgSQL((uchar*) "commit;", pData); /* TODO: make user-configurable */
+dbgprintf("ompgsql: endTransaction\n");
+ENDendTransaction
+
+
BEGINparseSelectorAct
int iPgSQLPropErr = 0;
CODESTARTparseSelectorAct
@@ -314,6 +333,7 @@ ENDmodExit
BEGINqueryEtryPt
CODESTARTqueryEtryPt
CODEqueryEtryPt_STD_OMOD_QUERIES
+CODEqueryEtryPt_TXIF_OMOD_QUERIES /* we support the transactional interface! */
ENDqueryEtryPt
@@ -322,6 +342,8 @@ CODESTARTmodInit
*ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */
CODEmodInit_QueryRegCFSLineHdlr
CHKiRet(objUse(errmsg, CORE_COMPONENT));
+ INITChkCoreFeature(bCoreSupportsBatching, CORE_FEATURE_BATCHING);
+ DBGPRINTF("ompgsql: %susing transactional output interface.\n", bCoreSupportsBatching ? "" : "not ");
ENDmodInit
/* vi:set ai:
*/