Bug #1070 Doubly Escaped Special Characters in ResultSet Update
Submitted: 18 Aug 2003 2:32 Modified: 18 Aug 2003 7:51
Reporter: Alan Tam Email Updates:
Status: Duplicate Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:3.0.8 OS:Linux (Linux)
Assigned to: Mark Matthews CPU Architecture:Any

[18 Aug 2003 2:32] Alan Tam
Description:
', ", \ and enter
in the parameter to updateString(String) will be escaped into
\\', \\", \\\\ and \\n
which is in turn stored in the DB as
\', \", \\ and \n (which are actually the correct escape sequences)

So it is suspected that they are escapted twice.

How to repeat:
Connection conn = ...;
Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
ResultSet rs = stmt.executeQuery(...);
rs.next();
rs.updateString(1, "\" \\ '");
rs.updateRow();

Suggested fix:
UpdatableResultSet.updateString calls:
PreparedStatement.setString which escaped the string

UpdatableResultSet.updateRow calls:
UpdatableResultSet.syncUpdate which calls:
PreparedStatement.setBytes which escapted the string once more!
[18 Aug 2003 7:51] Mark Matthews
Dupe of 1071
[18 Aug 2003 8:04] Alan Tam
I deliberately put them into 2 bugs, because #1070 does not occur in 3.1.0 while #1071 occurs in both 3.0.8 and 3.1.0.

#1070 is about a problem that simply UpdatableResultSet.updateString(int, String) does not work, while #1071 is about calling getString(int, String) after UpdatableResultSet.updateRow().