From abf682606ca71f6cbceeec84c220fcf6dc65487b Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Tue, 10 Jul 2007 15:30:20 +0000 Subject: [PATCH] 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/branches/1.2@74313 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- res/res_config_odbc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/res/res_config_odbc.c b/res/res_config_odbc.c index dbe37c289b..fcd4609cff 100644 --- a/res/res_config_odbc.c +++ b/res/res_config_odbc.c @@ -103,7 +103,8 @@ static struct ast_variable *realtime_odbc(const char *database, const char *tabl newval = va_arg(aq, const char *); } 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); if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) { @@ -251,7 +252,8 @@ static struct ast_config *realtime_multi_odbc(const char *database, const char * if (initfield) snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), " ORDER BY %s", initfield); 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); if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {