List:Commits« Previous MessageNext Message »
From:mmatthews Date:June 15 2006 9:22pm
Subject:Connector/J commit: r5389 - in branches: branch_3_1/connector-j branch_3_1/connector-j/src/com/mysql/jdbc branch_3_1/connector-j/src/testsuite/regress...
View as plain text  
Modified:
   branches/branch_3_1/connector-j/CHANGES
   branches/branch_3_1/connector-j/src/com/mysql/jdbc/UpdatableResultSet.java
   branches/branch_3_1/connector-j/src/testsuite/regression/ResultSetRegressionTest.java
   branches/branch_5_0/connector-j/CHANGES
   branches/branch_5_0/connector-j/src/com/mysql/jdbc/UpdatableResultSet.java
   branches/branch_5_0/connector-j/src/testsuite/regression/ResultSetRegressionTest.java
   branches/branch_5_1/connector-j/CHANGES
   branches/branch_5_1/connector-j/src/com/mysql/jdbc/UpdatableResultSet.java
Log:
Fixed BUG#20479 - Updatable result set throws ClassCastException
	  when there is row data and moveToInsertRow() is called.

Modified: branches/branch_3_1/connector-j/CHANGES
===================================================================
--- branches/branch_3_1/connector-j/CHANGES	2006-06-15 00:01:24 UTC (rev 5388)
+++ branches/branch_3_1/connector-j/CHANGES	2006-06-15 19:22:09 UTC (rev 5389)
@@ -1,8 +1,13 @@
 # Changelog
 # $Id$
- 
-05-26-05 - Version 3.1.13
 
+nn-nn-06 - Version 3.1.14
+
+    - Fixed BUG#20479 - Updatable result set throws ClassCastException
+	  when there is row data and moveToInsertRow() is called.
+	  
+05-26-06 - Version 3.1.13
+
     - Fixed BUG#15464 - INOUT parameter does not store IN value.
     
     - Fixed BUG#14609 - Exception thrown for new decimal type when 

Modified: branches/branch_3_1/connector-j/src/com/mysql/jdbc/UpdatableResultSet.java
===================================================================
--- branches/branch_3_1/connector-j/src/com/mysql/jdbc/UpdatableResultSet.java	2006-06-15
00:01:24 UTC (rev 5388)
+++ branches/branch_3_1/connector-j/src/com/mysql/jdbc/UpdatableResultSet.java	2006-06-15
19:22:09 UTC (rev 5389)
@@ -80,7 +80,7 @@
 	private String refreshSQL = null;
 
 	/** The binary data for the 'current' row */
-	private byte[][] savedCurrentRow;
+	private Object[] savedCurrentRow;
 
 	private String tableOnlyName;
 
@@ -906,7 +906,7 @@
 
 		this.onInsertRow = true;
 		this.doingUpdates = false;
-		this.savedCurrentRow = (byte[][]) this.thisRow;
+		this.savedCurrentRow = (Object[]) this.thisRow;
 		this.thisRow = new byte[numFields][];
 
 		for (int i = 0; i < numFields; i++) {

Modified:
branches/branch_3_1/connector-j/src/testsuite/regression/ResultSetRegressionTest.java
===================================================================
---
branches/branch_3_1/connector-j/src/testsuite/regression/ResultSetRegressionTest.java	2006-06-15
00:01:24 UTC (rev 5388)
+++
branches/branch_3_1/connector-j/src/testsuite/regression/ResultSetRegressionTest.java	2006-06-15
19:22:09 UTC (rev 5389)
@@ -2483,6 +2483,46 @@
 		}
 	}
 	
+	/**
+	 * Tests fix for BUG#20479 - Updatable result set throws ClassCastException
+	 * when there is row data and moveToInsertRow() is called.
+	 * 
+	 * @throws Exception if the test fails.
+	 */
+	public void testBug20479() throws Exception {
+		PreparedStatement updStmt = null;
+		
+		createTable("testBug20479", "(field1 INT NOT NULL PRIMARY KEY)");
+		this.stmt.executeUpdate("INSERT INTO testBug20479 VALUES (2), (3), (4)");
+		
+		try {
+			updStmt = this.conn.prepareStatement("SELECT * FROM testBug20479 Where field1 > ?
ORDER BY field1",
+			ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
+			
+			updStmt.setInt(1,1);			
+			this.rs = updStmt.executeQuery();
+			this.rs.next();
+			this.rs.moveToInsertRow();
+			this.rs.updateInt(1, 45);
+			this.rs.insertRow();
+			this.rs.moveToCurrentRow();
+			assertEquals(2, this.rs.getInt(1));
+			this.rs.next();
+			this.rs.next();
+			this.rs.next();
+			assertEquals(45, this.rs.getInt(1));
+		} finally {
+			if (this.rs != null) {
+				this.rs.close();
+				this.rs = null;
+			}
+			
+			if (updStmt != null) {
+				updStmt.close();
+			}		
+		}
+	}
+	
 	private void traverseResultSetBug14562() throws SQLException {
 		assertTrue(this.rs.next());
 

Modified: branches/branch_5_0/connector-j/CHANGES
===================================================================
--- branches/branch_5_0/connector-j/CHANGES	2006-06-15 00:01:24 UTC (rev 5388)
+++ branches/branch_5_0/connector-j/CHANGES	2006-06-15 19:22:09 UTC (rev 5389)
@@ -129,8 +129,13 @@
       for a cancel request to block other cancel requests if all run from the
       same thread.
       
-xx-xx-06 - Version 3.1.13
+nn-nn-06 - Version 3.1.14
 
+    - Fixed BUG#20479 - Updatable result set throws ClassCastException
+	  when there is row data and moveToInsertRow() is called.
+	  
+05-26-06 - Version 3.1.13
+
     - Fixed BUG#15464 - INOUT parameter does not store IN value.
     
     - Fixed BUG#14609 - Exception thrown for new decimal type when 

Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/UpdatableResultSet.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/UpdatableResultSet.java	2006-06-15
00:01:24 UTC (rev 5388)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/UpdatableResultSet.java	2006-06-15
19:22:09 UTC (rev 5389)
@@ -80,7 +80,7 @@
 	private String refreshSQL = null;
 
 	/** The binary data for the 'current' row */
-	private byte[][] savedCurrentRow;
+	private Object[] savedCurrentRow;
 
 	private String tableOnlyName;
 
@@ -906,7 +906,7 @@
 
 		this.onInsertRow = true;
 		this.doingUpdates = false;
-		this.savedCurrentRow = (byte[][]) this.thisRow;
+		this.savedCurrentRow = this.thisRow;
 		this.thisRow = new byte[numFields][];
 
 		for (int i = 0; i < numFields; i++) {

Modified:
branches/branch_5_0/connector-j/src/testsuite/regression/ResultSetRegressionTest.java
===================================================================
---
branches/branch_5_0/connector-j/src/testsuite/regression/ResultSetRegressionTest.java	2006-06-15
00:01:24 UTC (rev 5388)
+++
branches/branch_5_0/connector-j/src/testsuite/regression/ResultSetRegressionTest.java	2006-06-15
19:22:09 UTC (rev 5389)
@@ -3302,4 +3302,44 @@
 			}
 		}
 	}
+
+	/**
+	 * Tests fix for BUG#20479 - Updatable result set throws ClassCastException
+	 * when there is row data and moveToInsertRow() is called.
+	 * 
+	 * @throws Exception if the test fails.
+	 */
+	public void testBug20479() throws Exception {
+		PreparedStatement updStmt = null;
+		
+		createTable("testBug20479", "(field1 INT NOT NULL PRIMARY KEY)");
+		this.stmt.executeUpdate("INSERT INTO testBug20479 VALUES (2), (3), (4)");
+		
+		try {
+			updStmt = this.conn.prepareStatement("SELECT * FROM testBug20479 Where field1 > ?
ORDER BY field1",
+			ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
+			
+			updStmt.setInt(1,1);			
+			this.rs = updStmt.executeQuery();
+			this.rs.next();
+			this.rs.moveToInsertRow();
+			this.rs.updateInt(1, 45);
+			this.rs.insertRow();
+			this.rs.moveToCurrentRow();
+			assertEquals(2, this.rs.getInt(1));
+			this.rs.next();
+			this.rs.next();
+			this.rs.next();
+			assertEquals(45, this.rs.getInt(1));
+		} finally {
+			if (this.rs != null) {
+				this.rs.close();
+				this.rs = null;
+			}
+			
+			if (updStmt != null) {
+				updStmt.close();
+			}		
+		}
+	}
 }

Modified: branches/branch_5_1/connector-j/CHANGES
===================================================================
--- branches/branch_5_1/connector-j/CHANGES	2006-06-15 00:01:24 UTC (rev 5388)
+++ branches/branch_5_1/connector-j/CHANGES	2006-06-15 19:22:09 UTC (rev 5389)
@@ -102,9 +102,14 @@
       temporary tables.
       
     - Removed redundant code in com.mysql.jdbc.MysqlIO.
-      
-xx-xx-06 - Version 3.1.13
+    
+nn-nn-06 - Version 3.1.14
 
+    - Fixed BUG#20479 - Updatable result set throws ClassCastException
+	  when there is row data and moveToInsertRow() is called.
+	  
+05-26-06 - Version 3.1.13
+
     - Fixed BUG#15464 - INOUT parameter does not store IN value.
     
     - Fixed BUG#14609 - Exception thrown for new decimal type when 

Modified: branches/branch_5_1/connector-j/src/com/mysql/jdbc/UpdatableResultSet.java
===================================================================
--- branches/branch_5_1/connector-j/src/com/mysql/jdbc/UpdatableResultSet.java	2006-06-15
00:01:24 UTC (rev 5388)
+++ branches/branch_5_1/connector-j/src/com/mysql/jdbc/UpdatableResultSet.java	2006-06-15
19:22:09 UTC (rev 5389)
@@ -80,7 +80,7 @@
 	private String refreshSQL = null;
 
 	/** The binary data for the 'current' row */
-	private byte[][] savedCurrentRow;
+	private Object[] savedCurrentRow;
 
 	private String tableOnlyName;
 
@@ -906,7 +906,7 @@
 
 		this.onInsertRow = true;
 		this.doingUpdates = false;
-		this.savedCurrentRow = (byte[][]) this.thisRow;
+		this.savedCurrentRow = this.thisRow;
 		this.thisRow = new byte[numFields][];
 
 		for (int i = 0; i < numFields; i++) {

Thread
Connector/J commit: r5389 - in branches: branch_3_1/connector-j branch_3_1/connector-j/src/com/mysql/jdbc branch_3_1/connector-j/src/testsuite/regress...mmatthews15 Jun