Skip to content
Snippets Groups Projects
Commit 760649be authored by Russell Bryant's avatar Russell Bryant
Browse files

Merged revisions 74314 via svnmerge from

https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r74314 | russell | 2007-07-10 10:31:41 -0500 (Tue, 10 Jul 2007) | 11 lines

Merged revisions 74313 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r74313 | russell | 2007-07-10 10:30:20 -0500 (Tue, 10 Jul 2007) | 3 lines

Only use ESCAPE when LIKE is used.  
(issue #10075, this part reported by jmls on IRC, patch by me)

........

................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@74315 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent 76e2e39f
No related branches found
No related tags found
No related merge requests found
...@@ -109,7 +109,8 @@ static struct ast_variable *realtime_odbc(const char *database, const char *tabl ...@@ -109,7 +109,8 @@ static struct ast_variable *realtime_odbc(const char *database, const char *tabl
newval = va_arg(aq, const char *); newval = va_arg(aq, const char *);
} }
va_end(aq); va_end(aq);
snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), " ESCAPE '\\'"); if (strcasestr(sql, "LIKE"))
snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), " ESCAPE '\\'");
res = SQLPrepare(stmt, (unsigned char *)sql, SQL_NTS); res = SQLPrepare(stmt, (unsigned char *)sql, SQL_NTS);
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) { if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
...@@ -266,7 +267,8 @@ static struct ast_config *realtime_multi_odbc(const char *database, const char * ...@@ -266,7 +267,8 @@ static struct ast_config *realtime_multi_odbc(const char *database, const char *
if (initfield) if (initfield)
snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), " ORDER BY %s", initfield); snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), " ORDER BY %s", initfield);
va_end(aq); va_end(aq);
snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), " ESCAPE '\\'"); if (strcasestr(sql, "LIKE"))
snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), " ESCAPE '\\'");
res = SQLPrepare(stmt, (unsigned char *)sql, SQL_NTS); res = SQLPrepare(stmt, (unsigned char *)sql, SQL_NTS);
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) { if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment