[Asterisk-code-review] cdr/cdr adaptive odbc.c set empty value when column on table... (asterisk[master])

Rodrigo Ramirez Norambuena asteriskteam at digium.com
Tue Apr 21 18:58:29 CDT 2015


Rodrigo Ramirez Norambuena has uploaded a new change for review.

  https://gerrit.asterisk.org/191

Change subject: cdr/cdr_adaptive_odbc.c set empty value when column on table is not nulleable.
......................................................................

cdr/cdr_adaptive_odbc.c set empty value when column on table is not nulleable.

When in table is defined not null a column and value on CDR is NULL the record
is not saved.

ASTERISK-24992

Change-Id: I05d7ce71254e74ff9a931ebe7b418d803b88bc54
---
M cdr/cdr_adaptive_odbc.c
1 file changed, 5 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/91/191/1

diff --git a/cdr/cdr_adaptive_odbc.c b/cdr/cdr_adaptive_odbc.c
index 22f7d79..6bf7a87 100644
--- a/cdr/cdr_adaptive_odbc.c
+++ b/cdr/cdr_adaptive_odbc.c
@@ -436,6 +436,11 @@
 				ast_cdr_format_var(cdr, entry->cdrname, &colptr, colbuf, sizeof(colbuf), datefield ? 0 : 1);
 			}
 
+			/* If column on table is not nulleable set empty value */
+			if (entry->nullable == 0 && colptr == NULL)  {
+				colptr = "";
+			}
+			
 			if (colptr) {
 				/* Check first if the column filters this entry.  Note that this
 				 * is very specifically NOT ast_strlen_zero(), because the filter

-- 
To view, visit https://gerrit.asterisk.org/191
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I05d7ce71254e74ff9a931ebe7b418d803b88bc54
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Rodrigo Ramirez Norambuena <decipher.hk at gmail.com>



More information about the asterisk-code-review mailing list