List:Commits« Previous MessageNext Message »
From:mmatthews Date:June 15 2006 9:24pm
Subject:Connector/J commit: r5390 - branches/branch_5_1/connector-j/src/testsuite/regression
View as plain text  
Modified:
   branches/branch_5_1/connector-j/src/testsuite/regression/ResultSetRegressionTest.java
Log:
Merged from 5.0.

Modified:
branches/branch_5_1/connector-j/src/testsuite/regression/ResultSetRegressionTest.java
===================================================================
---
branches/branch_5_1/connector-j/src/testsuite/regression/ResultSetRegressionTest.java	2006-06-15
19:22:09 UTC (rev 5389)
+++
branches/branch_5_1/connector-j/src/testsuite/regression/ResultSetRegressionTest.java	2006-06-15
19:24:26 UTC (rev 5390)
@@ -3001,4 +3001,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();
+			}		
+		}
+	}
+
 }

Thread
Connector/J commit: r5390 - branches/branch_5_1/connector-j/src/testsuite/regressionmmatthews15 Jun