Bug #9498 Ensure compatibility with new server option: NO_BACKSLASH_ESCAPE
Submitted: 30 Mar 2005 18:59 Modified: 4 Jul 2007 0:13
Reporter: Ken Johanson Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S2 (Serious)
Version:3.51 OS:Any (Any)
Assigned to: Jim Winstead CPU Architecture:Any

[30 Mar 2005 18:59] Ken Johanson
Description:
Potential for data corruption if server is operated with new NO_BACKSLASH_ESCAPE option (due to unnecesary escaping of backslashes).

See: http://bugs.mysql.com/bug.php?id=6368

Example server config option - NO_BACKSLASH_ESCAPE is the new option.
Available starting on server version 5.0.3.
set-variable=sql-mode=PIPES_AS_CONCAT,ANSI_QUOTES,NO_BACKSLASH_ESCAPE

Using this option, executeQuery(String) SELECT 'a\\\"b' new yields
(correctly) a\\\"b, instead of 'a\"b'

Users who attempt to use this option in conjunction with PS (at least)
will experience data corruption.

How to repeat:
-Install server version 5.0.3
-Add "set-variable=sql-mode=PIPES_AS_CONCAT,ANSI_QUOTES,NO_BACKSLASH_ESCAPE"
to my.ini/my.cnf, restart

Suggested fix:
The good news is, this new feature is a change in the right direction.
The old backslash behavior was an interop issue.  :-)
[15 May 2007 20:23] Jim Winstead
Bug #28453 has been marked as a duplicate of this bug.
[27 May 2007 19:45] Jim Winstead
Bug #28708 has been marked as a duplicate of this bug.
[20 Jun 2007 19:02] Jim Winstead
This issue has been fixed in the repository, and will be in the upcoming 3.51.17. The driver was using mysql_odbc_escape_string(), which does not handle NO_BACKSLASH_ESCAPES mode. Now it uses mysql_real_escape_string(), which does.

To use a different character set with Connector/ODBC, it is necessary to specify it as part of the DSN or connection string, which is also a new feature in the upcoming 3.51.17.
[4 Jul 2007 0:13] Paul Dubois
Noted in 3.51.17 changelog.