List:Commits« Previous MessageNext Message »
From:mmatthews Date:December 7 2005 10:46pm
Subject:Connector/J commit: r4662 - in branches/branch_3_1/connector-j: . src/com/mysql/jdbc src/testsuite/regression src/testsuite/simple
View as plain text  
Modified:
   branches/branch_3_1/connector-j/CHANGES
   branches/branch_3_1/connector-j/src/com/mysql/jdbc/CallableStatement.java
   branches/branch_3_1/connector-j/src/testsuite/regression/CallableStatementRegressionTest.java
   branches/branch_3_1/connector-j/src/testsuite/simple/CallableStatementTest.java
Log:
Fixed BUG#15464 - INOUT parameter does not store IN value.

Modified: branches/branch_3_1/connector-j/CHANGES
===================================================================
--- branches/branch_3_1/connector-j/CHANGES	2005-12-07 01:03:52 UTC (rev 4661)
+++ branches/branch_3_1/connector-j/CHANGES	2005-12-07 22:46:54 UTC (rev 4662)
@@ -1,6 +1,10 @@
 # Changelog
 # $Id$
  
+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

Modified: branches/branch_3_1/connector-j/src/com/mysql/jdbc/CallableStatement.java
===================================================================
--- branches/branch_3_1/connector-j/src/com/mysql/jdbc/CallableStatement.java	2005-12-07 01:03:52 UTC (rev 4661)
+++ branches/branch_3_1/connector-j/src/com/mysql/jdbc/CallableStatement.java	2005-12-07 22:46:54 UTC (rev 4662)
@@ -1721,7 +1721,7 @@
 								.clientPrepareStatement(queryBuf.toString());
 
 						byte[] parameterAsBytes = this
-								.getBytesRepresentation(parameterIndex);
+								.getBytesRepresentation(inParamInfo.index);
 
 						if (parameterAsBytes != null) {
 							if (parameterAsBytes.length > 8

Modified: branches/branch_3_1/connector-j/src/testsuite/regression/CallableStatementRegressionTest.java
===================================================================
--- branches/branch_3_1/connector-j/src/testsuite/regression/CallableStatementRegressionTest.java	2005-12-07 01:03:52 UTC (rev 4661)
+++ branches/branch_3_1/connector-j/src/testsuite/regression/CallableStatementRegressionTest.java	2005-12-07 22:46:54 UTC (rev 4662)
@@ -584,4 +584,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");
+			}
+		}
+	}
 }

Modified: branches/branch_3_1/connector-j/src/testsuite/simple/CallableStatementTest.java
===================================================================
--- branches/branch_3_1/connector-j/src/testsuite/simple/CallableStatementTest.java	2005-12-07 01:03:52 UTC (rev 4661)
+++ branches/branch_3_1/connector-j/src/testsuite/simple/CallableStatementTest.java	2005-12-07 22:46:54 UTC (rev 4662)
@@ -71,21 +71,26 @@
 				this.stmt
 						.executeUpdate("DROP PROCEDURE IF EXISTS testInOutParam");
 				this.stmt
-						.executeUpdate("create procedure testInOutParam(INOUT foo VARCHAR(15))\n"
+						.executeUpdate("create procedure testInOutParam(IN p1 VARCHAR(255), INOUT p2 INT)\n"
 								+ "begin\n"
-								+ "select concat(foo, foo) INTO foo;\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 = this.conn.prepareCall("{call testInOutParam(?, ?)}");
 
 				storedProc.setString(1, "abcd");
-				storedProc.registerOutParameter(1, Types.VARCHAR);
+				storedProc.setInt(2, 4);
+				storedProc.registerOutParameter(2, Types.INTEGER);
 
 				storedProc.execute();
-				String retrievedString = storedProc.getString(1);
-				assertTrue(retrievedString.equals("abcdabcd"));
+		
+				assertEquals(5, storedProc.getInt(2));
 			} finally {
-				this.stmt.executeUpdate("DROP PROCEDURE testInOutParam");
+				this.stmt.executeUpdate("DROP PROCEDURE IF EXISTS testInOutParam");
 			}
 		}
 	}

Thread
Connector/J commit: r4662 - in branches/branch_3_1/connector-j: . src/com/mysql/jdbc src/testsuite/regression src/testsuite/simplemmatthews7 Dec