From e19a6c248fcdb241e574f4fba561f01ca63c9472 Mon Sep 17 00:00:00 2001 From: Tim Ringenbach Date: Wed, 14 Jul 2010 16:09:11 +0000 Subject: 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 --- cel/cel_pgsql.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'cel') 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); -- cgit v1.2.3