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
This commit is contained in:
Tim Ringenbach
2010-07-14 16:09:11 +00:00
parent ec37ffbdaf
commit e19a6c248f
3 changed files with 18 additions and 11 deletions

View File

@@ -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);