summaryrefslogtreecommitdiff
path: root/cel
diff options
context:
space:
mode:
authorTim Ringenbach <tim.ringenbach@gmail.com>2010-07-14 16:09:11 +0000
committerTim Ringenbach <tim.ringenbach@gmail.com>2010-07-14 16:09:11 +0000
commite19a6c248fcdb241e574f4fba561f01ca63c9472 (patch)
tree4dbe7cdfc3975c98aaa3a14c0db3e27b3ce05b30 /cel
parentec37ffbdaf4c8e9c134efd4e1fe7fd8bd72632ed (diff)
Fix documentation for pgsql cel and cdr, and slightly improve pgsql_cel.
Change the documented pgsql schema to use "timestamp" instead of "time", as the latter is only a time without a date. Added some missing columns for cel's pgsql schema, and corrected spelling on some others. Updated cel's uniqueid size to be the same as the cdr. Added id column to cel's pgsql schema and updated code to allow unknown columns to get their default value instead of forcing 0 or empty string. Added microseconds to the timestamp cel logs to pgsql. Review: https://reviewboard.asterisk.org/r/734 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@276349 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'cel')
-rw-r--r--cel/cel_pgsql.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/cel/cel_pgsql.c b/cel/cel_pgsql.c
index 17654875c..e4bdab1d7 100644
--- a/cel/cel_pgsql.c
+++ b/cel/cel_pgsql.c
@@ -55,7 +55,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/logger.h"
#include "asterisk.h"
-#define DATE_FORMAT "%Y-%m-%d %T"
+#define DATE_FORMAT "%Y-%m-%d %T.%6q"
static char *config = "cel_pgsql.conf";
static char *pghostname = NULL, *pgdbname = NULL, *pgdbuser = NULL, *pgpassword = NULL, *pgdbport = NULL, *table = NULL;
@@ -240,9 +240,12 @@ static void pgsql_log(const struct ast_event *event, void *userdata)
} else if (strcmp(cur->name, "peer") == 0) {
value = record.peer;
} else {
- value = "";
+ value = NULL;
}
- if (strncmp(cur->type, "int", 3) == 0) {
+
+ if (value == NULL) {
+ ast_str_append(&sql2, 0, "%sDEFAULT", SEP);
+ } else if (strncmp(cur->type, "int", 3) == 0) {
long long whatever;
if (value && sscanf(value, "%30lld", &whatever) == 1) {
LENGTHEN_BUF2(26);