List:Commits« Previous MessageNext Message »
From:mark Date:February 2 2009 5:00pm
Subject:bzr push into connector-j/branches/branch_5_1 branch (mark:760)
View as plain text  
  760 mark@stripped	2009-02-02 [merge]
      Merged from upstream
modified:
  CHANGES
  build.xml
  src/com/mysql/jdbc/ConnectionImpl.java
  src/com/mysql/jdbc/LoadBalancingConnectionProxy.java
  src/com/mysql/jdbc/LocalizedErrorMessages.properties
  src/com/mysql/jdbc/PreparedStatement.java
  src/com/mysql/jdbc/StatementImpl.java
  src/testsuite/BaseTestCase.java
  src/testsuite/regression/StatementRegressionTest.java

=== modified file 'src/testsuite/regression/StatementRegressionTest.java'
--- a/src/testsuite/regression/StatementRegressionTest.java	2009-01-23 18:21:18 +0000
+++ b/src/testsuite/regression/StatementRegressionTest.java	2009-02-02 17:00:13 +0000
@@ -5348,6 +5348,7 @@ public class StatementRegressionTest ext
 			String [] sequence = {"c", "a", "d", "b"};
 			String sql = "insert into testBug30493 (uniqueTextKey) values (?) on duplicate key UPDATE autoIncId = last_insert_id( autoIncId )";
 			String tablePrimeSql = "INSERT INTO testBug30493 (uniqueTextKey) VALUES ('a'), ('b'), ('c'), ('d')";
+
 			rewriteConn = getConnectionWithProps("rewriteBatchedStatements=true");
 
 			// setup the rewritten and non-written statements
@@ -5738,4 +5739,90 @@ public class StatementRegressionTest ext
 			rewriteConn.close();
 		}
 	}
+	
+	/** Ensures that cases listed in Bug#41448 actually work - we don't think there's a bug here right now */
+	
+	public void testBug41448() throws Exception {
+		createTable("testBug41448","(pk INT PRIMARY KEY AUTO_INCREMENT, field1 VARCHAR(4))");
+		
+		stmt.executeUpdate("INSERT INTO testBug41448 (field1) VALUES ('abc')", Statement.RETURN_GENERATED_KEYS);
+		stmt.getGeneratedKeys();
+		
+		stmt.executeUpdate("INSERT INTO testBug41448 (field1) VALUES ('def')", new int[] {1});
+		stmt.getGeneratedKeys();
+		
+		stmt.executeUpdate("INSERT INTO testBug41448 (field1) VALUES ('ghi')", new String[] {"pk"});
+		stmt.getGeneratedKeys();
+		
+		stmt.executeUpdate("INSERT INTO testBug41448 (field1) VALUES ('ghi')");
+		
+		try {
+			stmt.getGeneratedKeys();
+			fail("Expected a SQLException here");
+		} catch (SQLException sqlEx) {
+			// expected
+		}
+		
+		stmt.execute("INSERT INTO testBug41448 (field1) VALUES ('jkl')", Statement.RETURN_GENERATED_KEYS);
+		stmt.getGeneratedKeys();
+		
+		stmt.execute("INSERT INTO testBug41448 (field1) VALUES ('mno')", new int[] {1});
+		stmt.getGeneratedKeys();
+		
+		stmt.execute("INSERT INTO testBug41448 (field1) VALUES ('pqr')", new String[] {"pk"});
+		stmt.getGeneratedKeys();
+		
+		stmt.execute("INSERT INTO testBug41448 (field1) VALUES ('stu')");
+		
+		try {
+			stmt.getGeneratedKeys();
+			fail("Expected a SQLException here");
+		} catch (SQLException sqlEx) {
+			// expected
+		}
+		
+		try {
+			this.pstmt = this.conn.prepareStatement("INSERT INTO testBug41448 (field1) VALUES (?)", Statement.RETURN_GENERATED_KEYS);
+			this.pstmt.setString(1, "abc");
+			this.pstmt.executeUpdate();
+			this.pstmt.getGeneratedKeys();
+			this.pstmt.execute();
+			this.pstmt.getGeneratedKeys();
+			
+			this.pstmt = this.conn.prepareStatement("INSERT INTO testBug41448 (field1) VALUES (?)", new int[] {1});
+			this.pstmt.setString(1, "abc");
+			this.pstmt.executeUpdate();
+			this.pstmt.getGeneratedKeys();
+			this.pstmt.execute();
+			this.pstmt.getGeneratedKeys();
+			
+			this.pstmt = this.conn.prepareStatement("INSERT INTO testBug41448 (field1) VALUES (?)", new String[] {"pk"});
+			this.pstmt.setString(1, "abc");
+			this.pstmt.executeUpdate();
+			this.pstmt.getGeneratedKeys();
+			this.pstmt.execute();
+			this.pstmt.getGeneratedKeys();
+			
+			this.pstmt = this.conn.prepareStatement("INSERT INTO testBug41448 (field1) VALUES (?)");
+			this.pstmt.setString(1, "abc");
+			this.pstmt.executeUpdate();
+			try {
+				this.pstmt.getGeneratedKeys();
+				fail("Expected a SQLException here");
+			} catch (SQLException sqlEx) {
+				// expected
+			}
+			
+			this.pstmt.execute();
+			
+			try {
+				this.pstmt.getGeneratedKeys();
+				fail("Expected a SQLException here");
+			} catch (SQLException sqlEx) {
+				// expected
+			}
+		} finally {
+			closeMemberJDBCResources();
+		}
+	}
  } 
\ No newline at end of file

Thread
bzr push into connector-j/branches/branch_5_1 branch (mark:760) mark2 Feb