Modified:
branches/branch_5_0/connector-j/src/testsuite/regression/StatementRegressionTest.java
branches/branch_5_1/connector-j/src/com/mysql/jdbc/ServerPreparedStatement.java
branches/branch_5_1/connector-j/src/testsuite/regression/StatementRegressionTest.java
Log:
Fixed BUG#18041 - Server-side prepared statements don't cause
truncation exceptions to be thrown when truncation happens. (merges from 3.1)
Modified:
branches/branch_5_0/connector-j/src/testsuite/regression/StatementRegressionTest.java
===================================================================
---
branches/branch_5_0/connector-j/src/testsuite/regression/StatementRegressionTest.java 2006-03-09
20:05:02 UTC (rev 5031)
+++
branches/branch_5_0/connector-j/src/testsuite/regression/StatementRegressionTest.java 2006-03-09
20:50:30 UTC (rev 5032)
@@ -3078,5 +3078,4 @@
}
}
}
-
}
Modified: branches/branch_5_1/connector-j/src/com/mysql/jdbc/ServerPreparedStatement.java
===================================================================
---
branches/branch_5_1/connector-j/src/com/mysql/jdbc/ServerPreparedStatement.java 2006-03-09
20:05:02 UTC (rev 5031)
+++
branches/branch_5_1/connector-j/src/com/mysql/jdbc/ServerPreparedStatement.java 2006-03-09
20:50:30 UTC (rev 5032)
@@ -1128,7 +1128,7 @@
try {
if (this.timeout != 0
&& this.connection.versionMeetsMinimum(5, 0, 0)
- && usingCursor /* FIXME: Not supported currently */) {
+ && !usingCursor /* FIXME: Not supported currently */) {
timeoutThread = new CancelThread(this.timeout);
new Thread(timeoutThread).start();
}
Modified:
branches/branch_5_1/connector-j/src/testsuite/regression/StatementRegressionTest.java
===================================================================
---
branches/branch_5_1/connector-j/src/testsuite/regression/StatementRegressionTest.java 2006-03-09
20:05:02 UTC (rev 5031)
+++
branches/branch_5_1/connector-j/src/testsuite/regression/StatementRegressionTest.java 2006-03-09
20:50:30 UTC (rev 5032)
@@ -3079,4 +3079,45 @@
}
}
+ /**
+ * Tests fix for BUG#18041 - Server-side prepared statements
+ * don't cause truncation exceptions to be thrown.
+ *
+ * @throws Exception if the test fails
+ */
+ public void testBug18041() throws Exception {
+ if (versionMeetsMinimum(4, 1)) {
+ createTable("testBug18041", "(`a` tinyint(4) NOT NULL,"
+ + "`b` char(4) default NULL)");
+
+ Properties props = new Properties();
+ props.setProperty("jdbcCompliantTruncation", "true");
+ props.setProperty("useServerPrepStmts", "true");
+
+ Connection truncConn = null;
+ PreparedStatement stm = null;
+
+ try {
+ truncConn = getConnectionWithProps(props);
+
+ stm = truncConn
+ .prepareStatement("insert into testBug18041 values (?,?)");
+ stm.setInt(1, 1000);
+ stm.setString(2, "nnnnnnnnnnnnnnnnnnnnnnnnnnnnnn");
+ stm.executeUpdate();
+ fail("Truncation exception should have been thrown");
+ } catch (DataTruncation truncEx) {
+ // we expect this
+ } finally {
+ if (stmt != null) {
+ stmt.close();
+ }
+
+ if (truncConn != null) {
+ truncConn.close();
+ }
+ }
+ }
+ }
+
}
| Thread |
|---|
| • Connector/J commit: r5032 - in branches: branch_5_0/connector-j/src/testsuite/regression branch_5_1/connector-j/src/com/mysql/jdbc branch_5_1/connecto... | mmatthews | 9 Mar |