From 9fbc77488119d12eb182cbb3d10ec7a08a9058b5 Mon Sep 17 00:00:00 2001 From: russell Date: Fri, 6 Jul 2007 16:06:27 +0000 Subject: (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: http://svn.digium.com/svn/asterisk/branches/1.2@73684 f38db490-d61c-443f-a65b-d21fe96a405b --- res/res_config_odbc.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'res') diff --git a/res/res_config_odbc.c b/res/res_config_odbc.c index ec8e2be7b..dbe37c289 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); -- cgit v1.2.3