List:Commits« Previous MessageNext Message »
From:mmatthews Date:January 8 2008 6:37am
Subject:Connector/J commit: r6708 - in branches/branch_5_1: . src/com/mysql/jdbc src/testsuite/regression
View as plain text  
Modified:
   branches/branch_5_1/CHANGES
   branches/branch_5_1/src/com/mysql/jdbc/ConnectionImpl.java
   branches/branch_5_1/src/testsuite/regression/ConnectionRegressionTest.java
Log:
Fixed BUG#33734 - NullPointerException when using client-side
       prepared statements and enabling caching of prepared statements (only
       present in nightly builds of 5.1).

Modified: branches/branch_5_1/CHANGES
===================================================================
--- branches/branch_5_1/CHANGES	2008-01-04 22:06:31 UTC (rev 6707)
+++ branches/branch_5_1/CHANGES	2008-01-08 05:37:51 UTC (rev 6708)
@@ -118,6 +118,10 @@
        procedures, with the exception of stored procedures with registered 
        OUTPUT parameters, which can't be used at all with "streaming" result 
        sets.
+
+    -  Fixed BUG#33734 - NullPointerException when using client-side
+       prepared statements and enabling caching of prepared statements (only
+       present in nightly builds of 5.1).
        
 10-09-07 - Version 5.1.5
 

Modified: branches/branch_5_1/src/com/mysql/jdbc/ConnectionImpl.java
===================================================================
--- branches/branch_5_1/src/com/mysql/jdbc/ConnectionImpl.java	2008-01-04 22:06:31 UTC
(rev 6707)
+++ branches/branch_5_1/src/com/mysql/jdbc/ConnectionImpl.java	2008-01-08 05:37:51 UTC
(rev 6708)
@@ -908,6 +908,10 @@
 			return true;
 		}
 
+		if (!this.useServerPreparedStmts) {
+			return false;
+		}
+		
 		if (getCachePreparedStatements()) {
 			synchronized (this.serverSideStatementCheckCache) {
 				Boolean flag = (Boolean)this.serverSideStatementCheckCache.get(sql);
@@ -4085,7 +4089,7 @@
 		
 		String nativeSql = getProcessEscapeCodesForPrepStmts() ? nativeSQL(sql): sql;
 		
-		if (getEmulateUnsupportedPstmts()) {
+		if (this.useServerPreparedStmts && getEmulateUnsupportedPstmts()) {
 			canServerPrepare = canHandleAsServerPreparedStatement(nativeSql);
 		}
 		

Modified: branches/branch_5_1/src/testsuite/regression/ConnectionRegressionTest.java
===================================================================
--- branches/branch_5_1/src/testsuite/regression/ConnectionRegressionTest.java	2008-01-04
22:06:31 UTC (rev 6707)
+++ branches/branch_5_1/src/testsuite/regression/ConnectionRegressionTest.java	2008-01-08
05:37:51 UTC (rev 6708)
@@ -2318,4 +2318,20 @@
 		
 		assertTrue(System.currentTimeMillis() - begin < 10000);
 	}
-}
+	
+	/**
+	 * Tests fix for BUG#33734 - NullPointerException when using client-side
+	 * prepared statements and enabling caching of prepared statements (only present
+	 * in nightly builds of 5.1).
+	 * 
+	 * @throws Exception
+	 */
+	public void testBug33734() throws Exception {
+		Connection testConn =
getConnectionWithProps("cachePrepStmts=true,useServerPrepStmts=false");
+		try {
+			testConn.prepareStatement("SELECT 1");
+		} finally {
+			testConn.close();
+		}
+	}
+}
\ No newline at end of file

Thread
Connector/J commit: r6708 - in branches/branch_5_1: . src/com/mysql/jdbc src/testsuite/regressionmmatthews8 Jan