aboutsummaryrefslogtreecommitdiffstats
path: root/res
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-11-23 17:05:10 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-11-23 17:05:10 +0000
commit0d40e44dd72bfef43f3af99cd6dedab96326d260 (patch)
treec1a0dfdf1dd304e678c186ce8a1c72fe583f20c7 /res
parent146bbc427401277bce31a75932c6bcfc821d3b83 (diff)
Use ESCAPE clause for the first parameter, not just 2nd-Nth parameters.
Reported by: apsaras Patch by: tilghman (Closes issue #11353) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@89534 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res')
-rw-r--r--res/res_config_odbc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/res/res_config_odbc.c b/res/res_config_odbc.c
index ac3cffd16..202f2ea56 100644
--- a/res/res_config_odbc.c
+++ b/res/res_config_odbc.c
@@ -266,7 +266,8 @@ static struct ast_config *realtime_multi_odbc(const char *database, const char *
*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,