From: Date: November 16 2007 4:33pm Subject: Connector/J commit: r6665 - in trunk: . src/com/mysql/jdbc/jdbc2/optional src/testsuite/regression List-Archive: http://lists.mysql.com/commits/37957 X-Bug: 32101 Message-Id: <200711161533.lAGFXk9e029775@bk-internal.mysql.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modified: trunk/ trunk/CHANGES trunk/src/com/mysql/jdbc/jdbc2/optional/ConnectionWrapper.java trunk/src/testsuite/regression/DataSourceRegressionTest.java Log: Merged revisions 6585-6586,6593-6597,6599-6602,6605,6607-6609,6612,6614-6617,6619-6620,6623-6627,6632,6636-6638,6641,6649,6658-6659,6663-6664 via svnmerge from svn+ssh://mmatthews@stripped/connectors-svnroot/connector-j/branches/branch_5_1 ....... r6664 | mmatthews | 2007-11-16 09:24:21 -0600 (Fri, 16 Nov 2007) | 3 lines Fixed Bug#32101 - When using a connection from our ConnectionPoolDataSource, some Connection.prepareStatement() methods would return null instead of a prepared statement. ....... Property changes on: trunk ___________________________________________________________________ Name: svnmerge-integrated - /branches/branch_5_0:1-6625 /branches/branch_5_1:1-6582,6584-6662 + /branches/branch_5_0:1-6625 /branches/branch_5_1:1-6582,6584-6664 Modified: trunk/CHANGES =================================================================== --- trunk/CHANGES 2007-11-16 15:24:21 UTC (rev 6664) +++ trunk/CHANGES 2007-11-16 15:33:46 UTC (rev 6665) @@ -63,6 +63,10 @@ normal SELECTs won't have an error in this spot in the protocol unless an I/O error occurs. + - Fixed Bug#32101 - When using a connection from our ConnectionPoolDataSource, + some Connection.prepareStatement() methods would return null instead of + a prepared statement. + 10-09-07 - Version 5.1.5 - Released instead of 5.1.4 to pickup patch for BUG#31053 Modified: trunk/src/com/mysql/jdbc/jdbc2/optional/ConnectionWrapper.java =================================================================== --- trunk/src/com/mysql/jdbc/jdbc2/optional/ConnectionWrapper.java 2007-11-16 15:24:21 UTC (rev 6664) +++ trunk/src/com/mysql/jdbc/jdbc2/optional/ConnectionWrapper.java 2007-11-16 15:33:46 UTC (rev 6665) @@ -732,7 +732,7 @@ checkClosed(); try { - PreparedStatementWrapper.getInstance(this, this.mpc, this.mc + return PreparedStatementWrapper.getInstance(this, this.mpc, this.mc .prepareStatement(arg0, arg1)); } catch (SQLException sqlException) { checkAndFireConnectionError(sqlException); @@ -749,7 +749,7 @@ checkClosed(); try { - PreparedStatementWrapper.getInstance(this, this.mpc, this.mc + return PreparedStatementWrapper.getInstance(this, this.mpc, this.mc .prepareStatement(arg0, arg1)); } catch (SQLException sqlException) { checkAndFireConnectionError(sqlException); @@ -766,7 +766,7 @@ checkClosed(); try { - PreparedStatementWrapper.getInstance(this, this.mpc, this.mc + return PreparedStatementWrapper.getInstance(this, this.mpc, this.mc .prepareStatement(arg0, arg1)); } catch (SQLException sqlException) { checkAndFireConnectionError(sqlException); Modified: trunk/src/testsuite/regression/DataSourceRegressionTest.java =================================================================== --- trunk/src/testsuite/regression/DataSourceRegressionTest.java 2007-11-16 15:24:21 UTC (rev 6664) +++ trunk/src/testsuite/regression/DataSourceRegressionTest.java 2007-11-16 15:33:46 UTC (rev 6665) @@ -32,6 +32,7 @@ import java.lang.reflect.Method; import java.sql.Connection; import java.sql.PreparedStatement; +import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.Hashtable; @@ -470,4 +471,23 @@ } } } + + /** + * Tests fix for BUG#32101 - When using a connection from our ConnectionPoolDataSource, + * some Connection.prepareStatement() methods would return null instead of + * a prepared statement. + * + * @throws Exception + */ + public void testBug32101() throws Exception { + MysqlConnectionPoolDataSource ds = new MysqlConnectionPoolDataSource(); + ds.setURL(BaseTestCase.dbUrl); + PooledConnection pc = ds.getPooledConnection(); + assertNotNull(pc.getConnection().prepareStatement("SELECT 1")); + assertNotNull(pc.getConnection().prepareStatement("SELECT 1", Statement.RETURN_GENERATED_KEYS)); + assertNotNull(pc.getConnection().prepareStatement("SELECT 1", new int[0])); + assertNotNull(pc.getConnection().prepareStatement("SELECT 1", new String[0])); + assertNotNull(pc.getConnection().prepareStatement("SELECT 1", ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY)); + assertNotNull(pc.getConnection().prepareStatement("SELECT 1", ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT)); + } }