List:Commits« Previous MessageNext Message »
From:markm Date:May 7 2010 4:00pm
Subject:bzr push into connector-j/branches/branch_5_1 branch (markm:934 to 937)
View as plain text  
  937 markm@stripped	2010-05-07
      Bumped version number, new copyright notice

    modified:
      build.xml
  936 markm@stripped	2010-05-07
      Allow a single test to be run via the 'test' target by passing the fqcn in the 'test' property to Ant

    modified:
      build.xml
  935 markm@stripped	2010-05-06
      Fixed Bug#51704 - Re-written batched statements don't honor escape processing 
            flag of their creator.

    modified:
      CHANGES
      src/com/mysql/jdbc/StatementImpl.java
      src/testsuite/regression/StatementRegressionTest.java
  934 Todd Farmer	2010-04-30
      Changing compiler compliance.

    modified:
      .settings/org.eclipse.jdt.core.prefs
=== modified file 'CHANGES'
--- a/CHANGES	2010-04-22 10:21:11 +0000
+++ b/CHANGES	2010-05-06 19:33:08 +0000
@@ -86,6 +86,9 @@ nn-nn-10 - Version 5.1.13
       a comma-delimited list of fully-qualified class/interface names, against
       which the SQLException is checked to determine if it is an instance of any.
       Matches trigger failover to an alternate host.
+      
+    - Fixed Bug#51704 - Re-written batched statements don't honor escape processing 
+      flag of their creator.
     
 02-18-10 - Version 5.1.12
 

=== modified file 'build.xml'
--- a/build.xml	2010-02-12 06:31:11 +0000
+++ b/build.xml	2010-05-07 15:56:42 +0000
@@ -33,7 +33,7 @@
 
 	<property name="major_version" value="5"/>
 	<property name="minor_version" value="1"/>
-	<property name="subminor_version" value="12"/>
+	<property name="subminor_version" value="13"/>
 	<property name="version_status" value=""/>
 
 	<property name="version" value="${major_version}.${minor_version}.${subminor_version}${version_status}"/>
@@ -554,7 +554,9 @@ and the full path to the rt.jar from Jav
 
 			<formatter type="xml"/>
 
-			<batchtest todir="${junit.unitregress.results}" >
+			<test if="test" name="${test}" todir="${junit.unitregress.results}" />
+			
+			<batchtest unless="test" todir="${junit.unitregress.results}" >
 				<fileset dir="${buildDir}/${fullProdName}">
 					<include name="**/*Test.java" />
 					<exclude name="**/perf/*.java"/>
@@ -587,10 +589,9 @@ and the full path to the rt.jar from Jav
 
 			<formatter type="xml"/>
 
-			<batchtest todir="${junit.unitregress.results}" >
+			<batchtest unless="test" todir="${junit.unitregress.results}" >
 				<fileset dir="${buildDir}/${fullProdName}">
 					<include name="**/jdbc4/*Test.java" />
-
 				</fileset>
 			</batchtest>
 		</junit>

=== modified file 'src/com/mysql/jdbc/StatementImpl.java'
--- a/src/com/mysql/jdbc/StatementImpl.java	2010-04-06 17:20:14 +0000
+++ b/src/com/mysql/jdbc/StatementImpl.java	2010-05-06 19:33:08 +0000
@@ -1174,7 +1174,10 @@ public class StatementImpl implements St
 
 			int escapeAdjust = 1;
 
+			batchStmt.setEscapeProcessing(this.doEscapeProcessing);
+			
 			if (this.doEscapeProcessing) {
+				
 				escapeAdjust = 2; /* We assume packet _could_ grow by this amount, as we're not
 				                     sure how big statement will end up after
 				                     escape processing */

=== modified file 'src/testsuite/regression/StatementRegressionTest.java'
--- a/src/testsuite/regression/StatementRegressionTest.java	2010-04-30 14:45:10 +0000
+++ b/src/testsuite/regression/StatementRegressionTest.java	2010-05-06 19:33:08 +0000
@@ -6508,4 +6508,34 @@ public class StatementRegressionTest ext
 		}
 		
 	}
+	
+	/**
+	 * Tests fix for Bug#51704, rewritten batched statements don't honor
+	 * escape processing flag of Statement that they are created for
+	 */
+	public void testBug51704() throws Exception {
+		createTable("testBug51704", "(field1 TIMESTAMP)");
+		Connection rewriteConn = getConnectionWithProps("rewriteBatchedStatements=true");
+		Statement rewriteStmt = rewriteConn.createStatement();
+		
+		try {
+			rewriteStmt.setEscapeProcessing(false);
+			
+			for (int i = 0; i < 20; i++) {
+				rewriteStmt.addBatch("INSERT INTO testBug51704 VALUES ({tsp '2002-11-12 10:00:00'})");
+			}
+			
+			rewriteStmt.executeBatch(); // this should pass, because mysqld 
+										// doesn't validate any escape sequences, 
+										// it just strips them, where our escape 
+										// processor validates them
+			
+			Statement batchStmt = conn.createStatement();
+			batchStmt.setEscapeProcessing(false);
+			batchStmt.addBatch("INSERT INTO testBug51704 VALUES ({tsp '2002-11-12 10:00:00'})");
+			batchStmt.executeBatch(); // same here
+		} finally {
+			rewriteConn.close();
+		}
+	}
 }


Attachment: [text/bzr-bundle] bzr/markm@sun.com-20100507155642-d05n1smnjskomphd.bundle
Thread
bzr push into connector-j/branches/branch_5_1 branch (markm:934 to 937) markm7 May