[asterisk-commits] tringenbach: trunk r276349 - in /trunk: cel/ doc/tex/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jul 14 11:09:22 CDT 2010


Author: tringenbach
Date: Wed Jul 14 11:09:11 2010
New Revision: 276349

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=276349
Log:
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

Modified:
    trunk/cel/cel_pgsql.c
    trunk/doc/tex/cdrdriver.tex
    trunk/doc/tex/celdriver.tex

Modified: trunk/cel/cel_pgsql.c
URL: http://svnview.digium.com/svn/asterisk/trunk/cel/cel_pgsql.c?view=diff&rev=276349&r1=276348&r2=276349
==============================================================================
--- trunk/cel/cel_pgsql.c (original)
+++ trunk/cel/cel_pgsql.c Wed Jul 14 11:09:11 2010
@@ -55,7 +55,7 @@
 #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 @@
 				} else if (strcmp(cur->name, "peer") == 0) {
 					value = record.peer;
 				} else {
-					value = "";
-				}
-				if (strncmp(cur->type, "int", 3) == 0) {
+					value = NULL;
+				}
+
+				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);

Modified: trunk/doc/tex/cdrdriver.tex
URL: http://svnview.digium.com/svn/asterisk/trunk/doc/tex/cdrdriver.tex?view=diff&rev=276349&r1=276348&r2=276349
==============================================================================
--- trunk/doc/tex/cdrdriver.tex (original)
+++ trunk/doc/tex/cdrdriver.tex Wed Jul 14 11:09:11 2010
@@ -258,7 +258,7 @@
 \begin{astlisting}
 \begin{verbatim}
         CREATE TABLE cdr (
-                calldate      time               NOT NULL ,
+                calldate      timestamp             NOT NULL ,
                 clid          varchar (80)          NOT NULL ,
                 src           varchar (80)          NOT NULL ,
                 dst           varchar (80)          NOT NULL ,

Modified: trunk/doc/tex/celdriver.tex
URL: http://svnview.digium.com/svn/asterisk/trunk/doc/tex/celdriver.tex?view=diff&rev=276349&r1=276348&r2=276349
==============================================================================
--- trunk/doc/tex/celdriver.tex (original)
+++ trunk/doc/tex/celdriver.tex Wed Jul 14 11:09:11 2010
@@ -205,13 +205,15 @@
 
 \begin{verbatim}
         CREATE TABLE cel (
+                id            serial ,
                 eventtype     varchar (30)          NOT NULL ,
-                eventtime     time                  NOT NULL ,
-                cidname       varchar (80)          NOT NULL ,
-                cidnum        varchar (80)          NOT NULL ,
-                cidani        varchar (80)          NOT NULL ,
-                cidrdnis      varchar (80)          NOT NULL ,
-                ciddnis       varchar (80)          NOT NULL ,
+                eventtime     timestamp             NOT NULL ,
+                userdeftype   varchar(255)          NOT NULL ,
+                cid_name      varchar (80)          NOT NULL ,
+                cid_num       varchar (80)          NOT NULL ,
+                cid_ani       varchar (80)          NOT NULL ,
+                cid_rdnis     varchar (80)          NOT NULL ,
+                cid_dnid      varchar (80)          NOT NULL ,
                 exten         varchar (80)          NOT NULL ,
                 context       varchar (80)          NOT NULL ,
                 channame      varchar (80)          NOT NULL ,
@@ -219,7 +221,9 @@
                 appdata       varchar (80)          NOT NULL ,
                 amaflags      int                   NOT NULL ,
                 accountcode   varchar (20)          NOT NULL ,
-                uniqueid      varchar (32)          NOT NULL ,
+                peeraccount   varchar (20)          NOT NULL ,
+                uniqueid      varchar (150)         NOT NULL ,
+                linkedid      varchar (150)         NOT NULL ,
                 userfield     varchar (255)         NOT NULL ,
                 peer          varchar (80)          NOT NULL
         );




More information about the asterisk-commits mailing list