From: mmatthews Date: December 7 2005 10:48pm Subject: Connector/J commit: r4664 - in branches/branch_5_0/connector-j: . src/com/mysql/jdbc src/testsuite/regression List-Archive: http://lists.mysql.com/commits/34 Message-Id: <200512072248.jB7MmGTH008350@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/CallableStatement.java branches/branch_5_0/connector-j/src/testsuite/regression/CallableStatementRegressionTest.java Log: Fixed BUG#15464 - INOUT parameter does not store IN value (merged from 3.1 branch) Modified: branches/branch_5_0/connector-j/CHANGES =================================================================== --- branches/branch_5_0/connector-j/CHANGES 2005-12-07 22:47:59 UTC (rev 4663) +++ branches/branch_5_0/connector-j/CHANGES 2005-12-07 22:48:13 UTC (rev 4664) @@ -86,9 +86,14 @@ is currently no way to unblock the thread that is executing the query being cancelled due to timeout expiration and have it throw the exception instead. + +xx-xx-05 - Version 3.1.13 + - Fixed BUG#15464 - INOUT parameter does not store IN value. + 11-30-05 - Version 3.1.12 + - Fixed client-side prepared statement bug with embedded ? inside quoted identifiers (it was recognized as a placeholder, when it was not). 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 2005-12-07 22:47:59 UTC (rev 4663) +++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/CallableStatement.java 2005-12-07 22:48:13 UTC (rev 4664) @@ -1728,7 +1728,7 @@ .clientPrepareStatement(queryBuf.toString()); byte[] parameterAsBytes = this - .getBytesRepresentation(parameterIndex); + .getBytesRepresentation(inParamInfo.index); if (parameterAsBytes != null) { if (parameterAsBytes.length > 8 Modified: branches/branch_5_0/connector-j/src/testsuite/regression/CallableStatementRegressionTest.java =================================================================== --- branches/branch_5_0/connector-j/src/testsuite/regression/CallableStatementRegressionTest.java 2005-12-07 22:47:59 UTC (rev 4663) +++ branches/branch_5_0/connector-j/src/testsuite/regression/CallableStatementRegressionTest.java 2005-12-07 22:48:13 UTC (rev 4664) @@ -551,4 +551,43 @@ } } } + + /** + * Tests fix for BUG#15464 - INOUT parameter does not store IN value. + * + * @throws Exception + * if the test fails + */ + + public void testBug15464() throws Exception { + if (versionMeetsMinimum(5, 0)) { + CallableStatement storedProc = null; + + try { + this.stmt + .executeUpdate("DROP PROCEDURE IF EXISTS testInOutParam"); + this.stmt + .executeUpdate("create procedure testInOutParam(IN p1 VARCHAR(255), INOUT p2 INT)\n" + + "begin\n" + + " DECLARE z INT;\n" + + "SET z = p2 + 1;\n" + + "SET p2 = z;\n" + + "SELECT p1;\n" + + "SELECT CONCAT('zyxw', p1);\n" + + "end\n"); + + storedProc = this.conn.prepareCall("{call testInOutParam(?, ?)}"); + + storedProc.setString(1, "abcd"); + storedProc.setInt(2, 4); + storedProc.registerOutParameter(2, Types.INTEGER); + + storedProc.execute(); + + assertEquals(5, storedProc.getInt(2)); + } finally { + this.stmt.executeUpdate("DROP PROCEDURE IF EXISTS testInOutParam"); + } + } + } }