[asterisk-commits] tilghman: branch 1.4 r89534 - /branches/1.4/res/res_config_odbc.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Nov 23 11:05:10 CST 2007


Author: tilghman
Date: Fri Nov 23 11:05:10 2007
New Revision: 89534

URL: http://svn.digium.com/view/asterisk?view=rev&rev=89534
Log:
Use ESCAPE clause for the first parameter, not just 2nd-Nth parameters.
Reported by: apsaras
Patch by: tilghman
(Closes issue #11353)

Modified:
    branches/1.4/res/res_config_odbc.c

Modified: branches/1.4/res/res_config_odbc.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/res/res_config_odbc.c?view=diff&rev=89534&r1=89533&r2=89534
==============================================================================
--- branches/1.4/res/res_config_odbc.c (original)
+++ branches/1.4/res/res_config_odbc.c Fri Nov 23 11:05:10 2007
@@ -266,7 +266,8 @@
 		*op = '\0';
 	newval = va_arg(aq, const char *);
 	op = !strchr(newparam, ' ') ? " =" : "";
-	snprintf(sql, sizeof(sql), "SELECT * FROM %s WHERE %s%s ?", table, newparam, op);
+	snprintf(sql, sizeof(sql), "SELECT * FROM %s WHERE %s%s ?%s", table, newparam, op,
+		strcasestr(newparam, "LIKE") ? " ESCAPE '\\'" : "");
 	while((newparam = va_arg(aq, const char *))) {
 		op = !strchr(newparam, ' ') ? " =" : "";
 		snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), " AND %s%s ?%s", newparam, op,




More information about the asterisk-commits mailing list