]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 89534 via svnmerge from
authorTilghman Lesher <tilghman@meg.abyt.es>
Fri, 23 Nov 2007 17:09:06 +0000 (17:09 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Fri, 23 Nov 2007 17:09:06 +0000 (17:09 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r89534 | tilghman | 2007-11-23 11:05:10 -0600 (Fri, 23 Nov 2007) | 5 lines

Use ESCAPE clause for the first parameter, not just 2nd-Nth parameters.
Reported by: apsaras
Patch by: tilghman
(Closes issue #11353)

........

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89535 65c4cc65-6c06-0410-ace0-fbb531ad65f3

res/res_config_odbc.c

index 08adeb443aeacccb830599d469908832c3821fd2..2af47209a9ce99755e0afd4948a56cf6658ea6cf 100644 (file)
@@ -289,7 +289,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,