diff options
author | tringenbach <tringenbach@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-07-14 16:09:11 +0000 |
---|---|---|
committer | tringenbach <tringenbach@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-07-14 16:09:11 +0000 |
commit | 615374b0d1acc9711b540cb6c00d0ad58436dee0 (patch) | |
tree | 4dbe7cdfc3975c98aaa3a14c0db3e27b3ce05b30 /cel/cel_pgsql.c | |
parent | ad58aa92a221bb6cd0a4133112672528a52fd4f8 (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: http://svn.digium.com/svn/asterisk/trunk@276349 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'cel/cel_pgsql.c')
-rw-r--r-- | cel/cel_pgsql.c | 9 |
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); |