[asterisk-commits] rmudgett: branch group/issue8824 r172134 - in /team/group/issue8824: ./ res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jan 28 17:02:14 CST 2009


Author: rmudgett
Date: Wed Jan 28 17:02:14 2009
New Revision: 172134

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=172134
Log:
Resolved conflict and restarted automerge.

Merged revisions 172099,172131-172132 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
  r172099 | murf | 2009-01-28 15:48:37 -0600 (Wed, 28 Jan 2009) | 1 line
  
  my gcc (Ubuntu 4.3.2-1ubuntu11) 4.3.2 didn't like the \%ld and issued a warning, breaking my dev-mode build. This fixes it.
........
  r172131 | tilghman | 2009-01-28 16:48:01 -0600 (Wed, 28 Jan 2009) | 7 lines
  
  Fix how we skip fields (to avoid fields which don't exist) when doing an UPDATE.
  (closes issue #14205)
   Reported by: maxgo
   Patches: 
         20090128__bug14205__5.diff.txt uploaded by Corydon76 (license 14)
   Tested by: blitzrage
........
  r172132 | murf | 2009-01-28 16:52:06 -0600 (Wed, 28 Jan 2009) | 1 line
  
  A further correction: cast the sizeof to an int.
........

Modified:
    team/group/issue8824/   (props changed)
    team/group/issue8824/res/res_config_odbc.c

Propchange: team/group/issue8824/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/group/issue8824/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Jan 28 17:02:14 2009
@@ -1,1 +1,1 @@
-/trunk:1-172074
+/trunk:1-172133

Modified: team/group/issue8824/res/res_config_odbc.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue8824/res/res_config_odbc.c?view=diff&rev=172134&r1=172133&r2=172134
==============================================================================
--- team/group/issue8824/res/res_config_odbc.c (original)
+++ team/group/issue8824/res/res_config_odbc.c Wed Jan 28 17:02:14 2009
@@ -70,6 +70,8 @@
 		return NULL;
 	}
 
+	ast_debug(1, "Skip: %lld; SQL: %s\n", cps->skip, cps->sql);
+
 	res = SQLPrepare(stmt, (unsigned char *)cps->sql, SQL_NTS);
 	if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
 		ast_log(LOG_WARNING, "SQL Prepare failed![%s]\n", cps->sql);
@@ -79,9 +81,11 @@
 
 	while ((newparam = va_arg(ap, const char *))) {
 		newval = va_arg(ap, const char *);
-		if ((1 << count) & cps->skip) {
+		if ((1LL << count++) & cps->skip) {
+			ast_debug(1, "Skipping field '%s'='%s' (%llo/%llo)\n", newparam, newval, 1LL << (count - 1), cps->skip);
 			continue;
 		}
+		ast_debug(1, "Parameter %d ('%s') = '%s'\n", x, newparam, newval);
 		SQLBindParameter(stmt, x++, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(newval), 0, (void *)newval, 0, NULL);
 	}
 	va_end(ap);
@@ -404,7 +408,7 @@
 	char sql[256];
 	SQLLEN rowcount=0;
 	const char *newparam, *newval;
-	int res, count = 0;
+	int res, count = 1;
 	va_list aq;
 	struct custom_prepare_struct cps = { .sql = sql, .extra = lookup };
 	struct odbc_cache_tables *tableptr = ast_odbc_find_table(database, table);
@@ -438,11 +442,11 @@
 
 	snprintf(sql, sizeof(sql), "UPDATE %s SET %s=?", table, newparam);
 	while((newparam = va_arg(aq, const char *))) {
+		newval = va_arg(aq, const char *);
 		if ((tableptr && (column = ast_odbc_find_column(tableptr, newparam))) || count > 63) {
 			snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), ", %s=?", newparam);
-			newval = va_arg(aq, const char *);
-		} else { /* the column does not exist in the table OR we've exceeded the space in our flag field */
-			cps.skip |= (((long long)1) << count);
+		} else { /* the column does not exist in the table */
+			cps.skip |= (1LL << count);
 		}
 		count++;
 	}




More information about the asterisk-commits mailing list