From 83b91cb8940986b365d58b04fe633fe396ff5d6b Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Mon, 3 Dec 2007 11:06:46 +0000 Subject: adding sur5r's postgres module - many thanks for providing it! There are a number of patches necessary to core modules, because we need a new formatting function (date-pgsql). --- msg.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'msg.c') diff --git a/msg.c b/msg.c index 2cfa592d..a2f47975 100644 --- a/msg.c +++ b/msg.c @@ -536,6 +536,18 @@ char *getTimeReported(msg_t *pM, enum tplFormatTypes eFmt) } MsgUnlock(); return(pM->pszTIMESTAMP_MySQL); + case tplFmtPgSQLDate: + MsgLock(); + if(pM->pszTIMESTAMP_PgSQL == NULL) { + if((pM->pszTIMESTAMP_PgSQL = malloc(21)) == NULL) { + glblHadMemShortage = 1; + MsgUnlock(); + return ""; + } + formatTimestampToPgSQL(&pM->tTIMESTAMP, pM->pszTIMESTAMP_PgSQL, 21); + } + MsgUnlock(); + return(pM->pszTIMESTAMP_PgSQL); case tplFmtRFC3164Date: MsgLock(); if(pM->pszTIMESTAMP3164 == NULL) { @@ -554,7 +566,7 @@ char *getTimeReported(msg_t *pM, enum tplFormatTypes eFmt) if((pM->pszTIMESTAMP3339 = malloc(33)) == NULL) { glblHadMemShortage = 1; MsgUnlock(); - return ""; + return ""; /* TODO: check this: can it cause a free() of constant memory?) */ } formatTimestamp3339(&pM->tTIMESTAMP, pM->pszTIMESTAMP3339, 33); } @@ -594,6 +606,18 @@ char *getTimeGenerated(msg_t *pM, enum tplFormatTypes eFmt) } MsgUnlock(); return(pM->pszRcvdAt_MySQL); + case tplFmtPgSQLDate: + MsgLock(); + if(pM->pszRcvdAt_PgSQL == NULL) { + if((pM->pszRcvdAt_PgSQL = malloc(21)) == NULL) { + glblHadMemShortage = 1; + MsgUnlock(); + return ""; + } + formatTimestampToPgSQL(&pM->tRcvdAt, pM->pszRcvdAt_PgSQL, 21); + } + MsgUnlock(); + return(pM->pszRcvdAt_PgSQL); case tplFmtRFC3164Date: MsgLock(); if(pM->pszRcvdAt3164 == NULL) { -- cgit v1.2.3