[asterisk-commits] tilghman: branch 1.6.2 r236850 - in /branches/1.6.2: ./ cdr/cdr_adaptive_odbc.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Dec 30 11:56:40 CST 2009
Author: tilghman
Date: Wed Dec 30 11:56:38 2009
New Revision: 236850
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=236850
Log:
Merged revisions 236847 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r236847 | tilghman | 2009-12-30 11:53:29 -0600 (Wed, 30 Dec 2009) | 4 lines
When the field is blank, don't warn about the field being unable to be coerced, just skip the column.
(closes http://lists.digium.com/pipermail/asterisk-dev/2009-December/041362.html)
Reported by Nic Colledge on the -dev list, fixed by me.
........
Modified:
branches/1.6.2/ (props changed)
branches/1.6.2/cdr/cdr_adaptive_odbc.c
Propchange: branches/1.6.2/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.
Modified: branches/1.6.2/cdr/cdr_adaptive_odbc.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/cdr/cdr_adaptive_odbc.c?view=diff&rev=236850&r1=236849&r2=236850
==============================================================================
--- branches/1.6.2/cdr/cdr_adaptive_odbc.c (original)
+++ branches/1.6.2/cdr/cdr_adaptive_odbc.c Wed Dec 30 11:56:38 2009
@@ -316,7 +316,7 @@
#define LENGTHEN_BUF1(size) \
do { \
/* Lengthen buffer, if necessary */ \
- if (ast_str_strlen(sql) + size + 1 > ast_str_size(sql)) { \
+ if (ast_str_strlen(sql) + size + 1 > ast_str_size(sql)) { \
if (ast_str_make_space(&sql, ((ast_str_size(sql) + size + 1) / 512 + 1) * 512) != 0) { \
ast_log(LOG_ERROR, "Unable to allocate sufficient memory. Insert CDR '%s:%s' failed.\n", tableptr->connection, tableptr->table); \
ast_free(sql); \
@@ -329,7 +329,7 @@
#define LENGTHEN_BUF2(size) \
do { \
- if (ast_str_strlen(sql2) + size + 1 > ast_str_size(sql2)) { \
+ if (ast_str_strlen(sql2) + size + 1 > ast_str_size(sql2)) { \
if (ast_str_make_space(&sql2, ((ast_str_size(sql2) + size + 3) / 512 + 1) * 512) != 0) { \
ast_log(LOG_ERROR, "Unable to allocate sufficient memory. Insert CDR '%s:%s' failed.\n", tableptr->connection, tableptr->table); \
ast_free(sql); \
@@ -459,7 +459,9 @@
ast_str_append(&sql2, 0, "'");
break;
case SQL_TYPE_DATE:
- {
+ if (ast_strlen_zero(colptr)) {
+ continue;
+ } else {
int year = 0, month = 0, day = 0;
if (sscanf(colptr, "%4d-%2d-%2d", &year, &month, &day) != 3 || year <= 0 ||
month <= 0 || month > 12 || day < 0 || day > 31 ||
@@ -482,7 +484,9 @@
}
break;
case SQL_TYPE_TIME:
- {
+ if (ast_strlen_zero(colptr)) {
+ continue;
+ } else {
int hour = 0, minute = 0, second = 0;
int count = sscanf(colptr, "%2d:%2d:%2d", &hour, &minute, &second);
@@ -498,7 +502,9 @@
break;
case SQL_TYPE_TIMESTAMP:
case SQL_TIMESTAMP:
- {
+ if (ast_strlen_zero(colptr)) {
+ continue;
+ } else {
int year = 0, month = 0, day = 0, hour = 0, minute = 0, second = 0;
int count = sscanf(colptr, "%4d-%2d-%2d %2d:%2d:%2d", &year, &month, &day, &hour, &minute, &second);
@@ -524,7 +530,9 @@
}
break;
case SQL_INTEGER:
- {
+ if (ast_strlen_zero(colptr)) {
+ continue;
+ } else {
int integer = 0;
if (sscanf(colptr, "%30d", &integer) != 1) {
ast_log(LOG_WARNING, "CDR variable %s is not an integer.\n", entry->name);
@@ -537,7 +545,9 @@
}
break;
case SQL_BIGINT:
- {
+ if (ast_strlen_zero(colptr)) {
+ continue;
+ } else {
long long integer = 0;
if (sscanf(colptr, "%30lld", &integer) != 1) {
ast_log(LOG_WARNING, "CDR variable %s is not an integer.\n", entry->name);
@@ -550,7 +560,9 @@
}
break;
case SQL_SMALLINT:
- {
+ if (ast_strlen_zero(colptr)) {
+ continue;
+ } else {
short integer = 0;
if (sscanf(colptr, "%30hd", &integer) != 1) {
ast_log(LOG_WARNING, "CDR variable %s is not an integer.\n", entry->name);
@@ -563,7 +575,9 @@
}
break;
case SQL_TINYINT:
- {
+ if (ast_strlen_zero(colptr)) {
+ continue;
+ } else {
char integer = 0;
if (sscanf(colptr, "%30hhd", &integer) != 1) {
ast_log(LOG_WARNING, "CDR variable %s is not an integer.\n", entry->name);
@@ -576,7 +590,9 @@
}
break;
case SQL_BIT:
- {
+ if (ast_strlen_zero(colptr)) {
+ continue;
+ } else {
char integer = 0;
if (sscanf(colptr, "%30hhd", &integer) != 1) {
ast_log(LOG_WARNING, "CDR variable %s is not an integer.\n", entry->name);
@@ -592,7 +608,9 @@
break;
case SQL_NUMERIC:
case SQL_DECIMAL:
- {
+ if (ast_strlen_zero(colptr)) {
+ continue;
+ } else {
double number = 0.0;
if (sscanf(colptr, "%30lf", &number) != 1) {
ast_log(LOG_WARNING, "CDR variable %s is not an numeric type.\n", entry->name);
@@ -607,7 +625,9 @@
case SQL_FLOAT:
case SQL_REAL:
case SQL_DOUBLE:
- {
+ if (ast_strlen_zero(colptr)) {
+ continue;
+ } else {
double number = 0.0;
if (sscanf(colptr, "%30lf", &number) != 1) {
ast_log(LOG_WARNING, "CDR variable %s is not an numeric type.\n", entry->name);
More information about the asterisk-commits
mailing list