]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
(closes issue #10075)
authorRussell Bryant <russell@russellbryant.com>
Fri, 6 Jul 2007 16:06:27 +0000 (16:06 +0000)
committerRussell Bryant <russell@russellbryant.com>
Fri, 6 Jul 2007 16:06:27 +0000 (16:06 +0000)
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

res/res_config_odbc.c

index ec8e2be7bc4c018498cae1b7fbd0a1eeef9b2786..dbe37c289b0b75c2b1fca52b6b6e151e7c684575 100644 (file)
@@ -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);