From: Russell Bryant Date: Fri, 6 Jul 2007 16:06:27 +0000 (+0000) Subject: (closes issue #10075) X-Git-Tag: 1.2.21~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5e8172892e21f804280df02e92c342fdaab4ae6e;p=thirdparty%2Fasterisk.git (closes issue #10075) Reported by: apsaras Patches submitted by: Corydon76 Tested by: apsaras Fix a problem with MSSQL 2005 by explicitly stating that '\' is being used as an escape character. git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@73684 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/res/res_config_odbc.c b/res/res_config_odbc.c index ec8e2be7bc..dbe37c289b 100644 --- a/res/res_config_odbc.c +++ b/res/res_config_odbc.c @@ -103,6 +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 '\\'"); + res = SQLPrepare(stmt, (unsigned char *)sql, SQL_NTS); if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) { ast_log(LOG_WARNING, "SQL Prepare failed![%s]\n", sql); @@ -249,6 +251,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 '\\'"); + res = SQLPrepare(stmt, (unsigned char *)sql, SQL_NTS); if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) { ast_log(LOG_WARNING, "SQL Prepare failed![%s]\n", sql);