From: Date: June 27 2006 10:13pm Subject: Connector/J commit: r5444 - in branches/branch_5_0/connector-j: . src/com/mysql/jdbc src/testsuite/regression List-Archive: http://lists.mysql.com/commits/8349 X-Bug: 20687 Message-Id: <200606272013.k5RKDsLT030027@bk-internal.mysql.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modified: branches/branch_5_0/connector-j/CHANGES branches/branch_5_0/connector-j/src/com/mysql/jdbc/Connection.java branches/branch_5_0/connector-j/src/testsuite/regression/StatementRegressionTest.java Log: Fixed BUG#20687 - Can't pool server-side prepared statements, exception raised when re-using them. Modified: branches/branch_5_0/connector-j/CHANGES =================================================================== --- branches/branch_5_0/connector-j/CHANGES 2006-06-27 17:34:48 UTC (rev 5443) +++ branches/branch_5_0/connector-j/CHANGES 2006-06-27 20:13:53 UTC (rev 5444) @@ -174,6 +174,9 @@ - Fixed BUG#20306 - ResultSet.getShort() for UNSIGNED TINYINT returns incorrect values when using server-side prepared statements. + + - Fixed BUG#20687 - Can't pool server-side prepared statements, exception + raised when re-using them. 05-26-06 - Version 3.1.13 Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/Connection.java =================================================================== --- branches/branch_5_0/connector-j/src/com/mysql/jdbc/Connection.java 2006-06-27 17:34:48 UTC (rev 5443) +++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/Connection.java 2006-06-27 20:13:53 UTC (rev 5444) @@ -4569,8 +4569,8 @@ pStmt = (com.mysql.jdbc.ServerPreparedStatement)this.serverSideStatementCache.remove(sql); if (pStmt != null) { + ((com.mysql.jdbc.ServerPreparedStatement)pStmt).setClosed(false); pStmt.clearParameters(); - ((com.mysql.jdbc.ServerPreparedStatement)pStmt).setClosed(false); } if (pStmt == null) { Modified: branches/branch_5_0/connector-j/src/testsuite/regression/StatementRegressionTest.java =================================================================== --- branches/branch_5_0/connector-j/src/testsuite/regression/StatementRegressionTest.java 2006-06-27 17:34:48 UTC (rev 5443) +++ branches/branch_5_0/connector-j/src/testsuite/regression/StatementRegressionTest.java 2006-06-27 20:13:53 UTC (rev 5444) @@ -3245,6 +3245,34 @@ } } + /** + * Fixes BUG#20687 - Can't pool server-side prepared statements, exception + * raised when re-using them. + * + * @throws Exception if the test fails. + */ + public void testBug20687() throws Exception { + createTable("testBug20687", "(field1 int)"); + Connection poolingConn = null; + + Properties props = new Properties(); + props.setProperty("cachePrepStmts", "true"); + + try { + poolingConn = getConnectionWithProps(props); + PreparedStatement pstmt1 = poolingConn.prepareStatement("SELECT field1 FROM testBug20687"); + pstmt1.executeQuery(); + pstmt1.close(); + + PreparedStatement pstmt2 = poolingConn.prepareStatement("SELECT field1 FROM testBug20687"); + pstmt2.executeQuery(); + assertSame(pstmt1, pstmt2); + pstmt2.close(); + } finally { + + } + } + public void testLikeWithBackslashes() throws Exception { if (!versionMeetsMinimum(5, 0, 0)) { return;