Modified:
branches/branch_5_0/connector-j/CHANGES
branches/branch_5_0/connector-j/src/com/mysql/jdbc/CallableStatement.java
branches/branch_5_0/connector-j/src/testsuite/regression/CallableStatementRegressionTest.java
trunk/connector-j/CHANGES
trunk/connector-j/src/com/mysql/jdbc/CallableStatement.java
trunk/connector-j/src/testsuite/regression/CallableStatementRegressionTest.java
Log:
Fixed BUG#25379 - INOUT parameters in CallableStatements get
doubly-escaped.
Modified: branches/branch_5_0/connector-j/CHANGES
===================================================================
--- branches/branch_5_0/connector-j/CHANGES 2007-01-10 22:49:25 UTC (rev 6291)
+++ branches/branch_5_0/connector-j/CHANGES 2007-01-10 23:48:50 UTC (rev 6292)
@@ -16,8 +16,7 @@
columns not referenced in them.
- Fixed BUG#24360 .setFetchSize() breaks prepared SHOW and other commands.
-
-
+
- Fixed BUG#24344 - useJDBCCompliantTimezoneShift with server-side prepared
statements gives different behavior than when using client-side prepared
statements. (this is now fixed if moving from server-side prepared statements
@@ -72,7 +71,10 @@
- Fixed BUG#25399 - EscapeProcessor gets confused by multiple
backslashes. We now push the responsibility of syntax errors back
on to the server for most escape sequences.
-
+
+ - Fixed BUG#25379 - INOUT parameters in CallableStatements get
+ doubly-escaped.
+
10-20-06 - Version 5.0.4
- Fixed BUG#21379 - column names don't match metadata in cases
Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/CallableStatement.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/CallableStatement.java 2007-01-10
22:49:25 UTC (rev 6291)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/CallableStatement.java 2007-01-10
23:48:50 UTC (rev 6292)
@@ -1971,7 +1971,8 @@
setPstmt.setBytesNoEscapeNoQuotes(1,
parameterAsBytes);
} else {
- setPstmt.setBytes(1, parameterAsBytes);
+ setPstmt.setBytesNoEscape(1, parameterAsBytes); // they've already been escaped
by
+ // the inherited PreparedStatement methods
}
} else {
setPstmt.setNull(1, Types.NULL);
Modified:
branches/branch_5_0/connector-j/src/testsuite/regression/CallableStatementRegressionTest.java
===================================================================
---
branches/branch_5_0/connector-j/src/testsuite/regression/CallableStatementRegressionTest.java 2007-01-10
22:49:25 UTC (rev 6291)
+++
branches/branch_5_0/connector-j/src/testsuite/regression/CallableStatementRegressionTest.java 2007-01-10
23:48:50 UTC (rev 6292)
@@ -905,4 +905,34 @@
}
}
}
+
+ /**
+ * Tests fix for BUG#25379 - INOUT parameters in CallableStatements get doubly-escaped.
+ *
+ * @throws Exception if the test fails.
+ */
+ public void testBug25379() throws Exception {
+ if (!versionMeetsMinimum(5, 0)) {
+ return;
+ }
+
+ createTable("testBug25379", "(col char(40))");
+
+ try {
+ this.stmt.executeUpdate("DROP PROCEDURE IF EXISTS sp_testBug25379");
+ this.stmt.executeUpdate("CREATE PROCEDURE sp_testBug25379 (INOUT invalue char(255))"
+ + "\nBEGIN"
+ + "\ninsert into testBug25379(col) values(invalue);"
+ + "\nEND");
+
+
+ CallableStatement cstmt = this.conn.prepareCall("{call sp_testBug25379(?)}");
+ cstmt.setString(1,"'john'");
+ cstmt.executeUpdate();
+ assertEquals("'john'", cstmt.getString(1));
+ assertEquals("'john'", getSingleValue("testBug25379", "col", "").toString());
+ } finally {
+ this.stmt.executeUpdate("DROP PROCEDURE IF EXISTS sp_testBug25379");
+ }
+ }
}
Modified: trunk/connector-j/CHANGES
===================================================================
--- trunk/connector-j/CHANGES 2007-01-10 22:49:25 UTC (rev 6291)
+++ trunk/connector-j/CHANGES 2007-01-10 23:48:50 UTC (rev 6292)
@@ -68,7 +68,10 @@
- Fixed BUG#25399 - EscapeProcessor gets confused by multiple
backslashes. We now push the responsibility of syntax errors back
on to the server for most escape sequences.
-
+
+ - Fixed BUG#25379 - INOUT parameters in CallableStatements get
+ doubly-escaped.
+
10-20-06 - Version 5.0.4
- Fixed BUG#21379 - column names don't match metadata in cases
Modified: trunk/connector-j/src/com/mysql/jdbc/CallableStatement.java
===================================================================
--- trunk/connector-j/src/com/mysql/jdbc/CallableStatement.java 2007-01-10 22:49:25 UTC
(rev 6291)
+++ trunk/connector-j/src/com/mysql/jdbc/CallableStatement.java 2007-01-10 23:48:50 UTC
(rev 6292)
@@ -1997,7 +1997,7 @@
setPstmt.setBytesNoEscapeNoQuotes(1,
parameterAsBytes);
} else {
- setPstmt.setBytes(1, parameterAsBytes);
+ setPstmt.setBytesNoEscape(1, parameterAsBytes);
}
} else {
setPstmt.setNull(1, Types.NULL);
Modified: trunk/connector-j/src/testsuite/regression/CallableStatementRegressionTest.java
===================================================================
---
trunk/connector-j/src/testsuite/regression/CallableStatementRegressionTest.java 2007-01-10
22:49:25 UTC (rev 6291)
+++
trunk/connector-j/src/testsuite/regression/CallableStatementRegressionTest.java 2007-01-10
23:48:50 UTC (rev 6292)
@@ -897,4 +897,34 @@
}
}
}
+
+ /**
+ * Tests fix for BUG#25379 - INOUT parameters in CallableStatements get doubly-escaped.
+ *
+ * @throws Exception if the test fails.
+ */
+ public void testBug25379() throws Exception {
+ if (!versionMeetsMinimum(5, 0)) {
+ return;
+ }
+
+ createTable("testBug25379", "(col char(40))");
+
+ try {
+ this.stmt.executeUpdate("DROP PROCEDURE IF EXISTS sp_testBug25379");
+ this.stmt.executeUpdate("CREATE PROCEDURE sp_testBug25379 (INOUT invalue char(255))"
+ + "\nBEGIN"
+ + "\ninsert into testBug25379(col) values(invalue);"
+ + "\nEND");
+
+
+ CallableStatement cstmt = this.conn.prepareCall("{call sp_testBug25379(?)}");
+ cstmt.setString(1,"'john'");
+ cstmt.executeUpdate();
+ assertEquals("'john'", cstmt.getString(1));
+ assertEquals("'john'", getSingleValue("testBug25379", "col", "").toString());
+ } finally {
+ this.stmt.executeUpdate("DROP PROCEDURE IF EXISTS sp_testBug25379");
+ }
+ }
}
| Thread |
|---|
| • Connector/J commit: r6292 - branches/branch_5_0/connector-j branches/branch_5_0/connector-j/src/com/mysql/jdbc branches/branch_5_0/connector-j/src/tes... | mmatthews | 11 Jan |