[asterisk-commits] tilghman: branch tilghman/cdr_custom_odbc r64834 - /team/tilghman/cdr_custom_...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu May 17 15:05:35 MST 2007


Author: tilghman
Date: Thu May 17 17:05:34 2007
New Revision: 64834

URL: http://svn.digium.com/view/asterisk?view=rev&rev=64834
Log:
Fix aliases, and better deal with start, answer, and end columns

Modified:
    team/tilghman/cdr_custom_odbc/cdr/cdr_adaptive_odbc.c

Modified: team/tilghman/cdr_custom_odbc/cdr/cdr_adaptive_odbc.c
URL: http://svn.digium.com/view/asterisk/team/tilghman/cdr_custom_odbc/cdr/cdr_adaptive_odbc.c?view=diff&rev=64834&r1=64833&r2=64834
==============================================================================
--- team/tilghman/cdr_custom_odbc/cdr/cdr_adaptive_odbc.c (original)
+++ team/tilghman/cdr_custom_odbc/cdr/cdr_adaptive_odbc.c Thu May 17 17:05:34 2007
@@ -167,7 +167,9 @@
 			 */
 			for (var = ast_variable_browse(cfg, catg); var; var = var->next) {
 				if (strcasecmp(var->value, columnname) == 0) {
-					cdrvar = ast_strip(ast_strdupa(var->name + 5));
+					char *tmp = ast_strdupa(var->name + 5);
+					cdrvar = ast_strip(tmp);
+					ast_verbose(VERBOSE_PREFIX_4 "Found alias %s for column %s\n", cdrvar, columnname);
 					break;
 				}
 			}
@@ -299,7 +301,10 @@
 
 		AST_LIST_TRAVERSE(&(tableptr->columns), entry, list) {
 			/* Check if we have a similarly named variable */
-			ast_cdr_getvar(cdr, entry->name, &colptr, colbuf, sizeof(colbuf), 0, 1);
+			ast_cdr_getvar(cdr, entry->cdrname, &colptr, colbuf, sizeof(colbuf), 0,
+				(strcasecmp(entry->cdrname, "start") == 0 ||
+				 strcasecmp(entry->cdrname, "answer") == 0 ||
+				 strcasecmp(entry->cdrname, "end") == 0) ? 0 : 1);
 
 			if (colptr) {
 				LENGTHEN_BUF1(strlen(entry->name));
@@ -517,6 +522,8 @@
 		sql2[lensql2 - 1] = ')';
 		strcat(sql + lensql, sql2);
 
+		if (option_verbose > 10)
+			ast_verbose(VERBOSE_PREFIX_4 "[%s]\n", sql);
 		obj = ast_odbc_request_obj(tableptr->connection, 1);
 		if (obj) {
 			stmt = ast_odbc_prepare_and_execute(obj, generic_prepare, sql);



More information about the asterisk-commits mailing list