List:Commits« Previous MessageNext Message »
From:mmatthews Date:October 2 2007 9:36pm
Subject:Connector/J commit: r6595 - in branches/branch_5_0/connector-j: . src/com/mysql/jdbc src/testsuite/regression
View as plain text  
Modified:
   branches/branch_5_0/connector-j/CHANGES
   branches/branch_5_0/connector-j/src/com/mysql/jdbc/PreparedStatement.java
   branches/branch_5_0/connector-j/src/testsuite/regression/StatementRegressionTest.java
Log:
Fixed Bug#27412 - cached metadata with PreparedStatement.execute()
      throws NullPointerException.

Modified: branches/branch_5_0/connector-j/CHANGES
===================================================================
--- branches/branch_5_0/connector-j/CHANGES	2007-10-01 15:14:53 UTC (rev 6594)
+++ branches/branch_5_0/connector-j/CHANGES	2007-10-02 19:36:55 UTC (rev 6595)
@@ -66,7 +66,10 @@
       
     - XAConnections now start in auto-commit mode (as per JDBC-4.0 specification
       clarification).
-      
+     
+    - Fixed Bug#27412 - cached metadata with PreparedStatement.execute()
+      throws NullPointerException.
+       
 07-19-07 - Version 5.0.7
 
     - Setting the configuration parameter "useCursorFetch" to "true" for 

Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/PreparedStatement.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/PreparedStatement.java	2007-10-01 15:14:53 UTC (rev 6594)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/PreparedStatement.java	2007-10-02 19:36:55 UTC (rev 6595)
@@ -890,7 +890,7 @@
 			} else {
 				if (rs.reallyResult() && locallyScopedConn.getCacheResultSetMetadata()) {
 					locallyScopedConn.initializeResultsMetadataFromCache(this.originalSql,
-							null /* will be created */, this.results);
+							null /* will be created */, rs);
 				}
 			}
 			

Modified: branches/branch_5_0/connector-j/src/testsuite/regression/StatementRegressionTest.java
===================================================================
--- branches/branch_5_0/connector-j/src/testsuite/regression/StatementRegressionTest.java	2007-10-01 15:14:53 UTC (rev 6594)
+++ branches/branch_5_0/connector-j/src/testsuite/regression/StatementRegressionTest.java	2007-10-02 19:36:55 UTC (rev 6595)
@@ -47,10 +47,8 @@
 import java.sql.SQLException;
 import java.sql.SQLWarning;
 import java.sql.Statement;
-import java.sql.Time;
 import java.sql.Timestamp;
 import java.sql.Types;
-import java.text.SimpleDateFormat;
 import java.util.Calendar;
 import java.util.Locale;
 import java.util.Properties;
@@ -3176,6 +3174,7 @@
 		return isJdbc4;
 	}
 
+	
 	/**
 	 * Tests fix for BUG#19615, PreparedStatement.setObject(int, Object, int)
 	 * doesn't respect scale of BigDecimals.
@@ -4196,4 +4195,29 @@
 			}
 		}
 	}
+	
+	/**
+	 * Tests fix for Bug#27412 - cached metadata with PreparedStatement.execute()
+	 * throws NullPointerException.
+	 * 
+	 * @throws Exception
+	 */
+	public void testBug27412() throws Exception {
+		try {
+			Properties props = new Properties();
+			props.put("useServerPrepStmts", "false");
+			props.put("cachePreparedStatements", "true");
+			props.put("cacheResultSetMetadata", "true");
+			Connection conn2 = getConnectionWithProps(props);
+			PreparedStatement pstm = conn2.prepareStatement("SELECT 1");
+			try {
+				assertTrue(pstm.execute());
+			} finally {
+				pstm.close();
+				conn2.close();
+			}
+		} finally {
+			closeMemberJDBCResources();
+		}
+	}
 }
\ No newline at end of file

Thread
Connector/J commit: r6595 - in branches/branch_5_0/connector-j: . src/com/mysql/jdbc src/testsuite/regressionmmatthews2 Oct