[svn-commits] tilghman: branch 1.6.0 r787 - /branches/1.6.0/cdr/cdr_addon_mysql.c
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Fri Feb 20 16:00:09 CST 2009
Author: tilghman
Date: Fri Feb 20 16:00:09 2009
New Revision: 787
URL: http://svn.digium.com/svn-view/asterisk-addons?view=rev&rev=787
Log:
Only add a field if it's not NULL.
Modified:
branches/1.6.0/cdr/cdr_addon_mysql.c
Modified: branches/1.6.0/cdr/cdr_addon_mysql.c
URL: http://svn.digium.com/svn-view/asterisk-addons/branches/1.6.0/cdr/cdr_addon_mysql.c?view=diff&rev=787&r1=786&r2=787
==============================================================================
--- branches/1.6.0/cdr/cdr_addon_mysql.c (original)
+++ branches/1.6.0/cdr/cdr_addon_mysql.c Fri Feb 20 16:00:09 2009
@@ -252,11 +252,6 @@
}
/* Construct SQL */
- if (column_count++) {
- strcat(sql1, ",");
- strcat(sql2, "','");
- }
-
if (strlen(sql1) + 2 + strlen(entry->name) > sql1size) {
char *tmp = ast_realloc(sql1, sql1size * 2);
if (!tmp)
@@ -264,8 +259,6 @@
sql1size *= 2;
sql1 = tmp;
}
- strcat(sql1, entry->name);
-
/* Need the type and value to determine if we want the raw value or not */
if ((!strcmp(cdrname, "start") ||
!strcmp(cdrname, "answer") ||
@@ -291,6 +284,13 @@
sql2 = tmp;
}
if (value) {
+ if (column_count++) {
+ strcat(sql1, ",");
+ strcat(sql2, "','");
+ }
+
+ strcat(sql1, entry->name);
+
/*!\note We're manually escaping here, to ensure that we know exactly
* how much space is used. Since we only accept ASCII strings at this
* point in time, there is no danger in this simplistic escape method,
More information about the svn-commits
mailing list