839 markm@stripped 2009-08-10
Fix for a variant of Bug#41484 - ResultSet.find*(String) failed when using cached result set metadata.
modified:
CHANGES
src/com/mysql/jdbc/ResultSetImpl.java
src/testsuite/regression/ResultSetRegressionTest.java
838 markm@stripped 2009-08-04
Fixed Bug#45040
modified:
CHANGES
=== modified file 'CHANGES'
--- a/CHANGES 2009-08-04 13:53:26 +0000
+++ b/CHANGES 2009-08-10 17:21:30 +0000
@@ -5,6 +5,9 @@ nn-nn-09 - Version 5.1.9
- Fixed BUG#45040, adding missing tags from SVN import to BZR branch for
5.1.
+
+ - Fix for a variant of Bug#41484 - ResultSet.find*(String) failed when using cached result set
+ metadata.
07-16-09 - Version 5.1.8
- Fixed BUG#44588 - Fixed error message for connection exceptions when
=== modified file 'src/com/mysql/jdbc/ResultSetImpl.java'
--- a/src/com/mysql/jdbc/ResultSetImpl.java 2009-02-12 20:09:02 +0000
+++ b/src/com/mysql/jdbc/ResultSetImpl.java 2009-08-10 17:21:30 +0000
@@ -505,6 +505,8 @@ public class ResultSetImpl implements Re
public void initializeWithMetadata() throws SQLException {
this.rowData.setMetadata(this.fields);
+ this.columnToIndexCache = new HashMap();
+
if (this.profileSql || this.connection.getUseUsageAdvisor()) {
this.columnUsed = new boolean[this.fields.length];
this.pointOfOrigin = new Throwable();
@@ -729,8 +731,6 @@ public class ResultSetImpl implements Re
this.columnLabelToIndex = new TreeMap(String.CASE_INSENSITIVE_ORDER);
this.fullColumnNameToIndex = new TreeMap(String.CASE_INSENSITIVE_ORDER);
this.columnNameToIndex = new TreeMap(String.CASE_INSENSITIVE_ORDER);
- this.columnToIndexCache = new HashMap();
-
// We do this in reverse order, so that the 'first' column
// with a given name ends up as the final mapping in the
=== modified file 'src/testsuite/regression/ResultSetRegressionTest.java'
--- a/src/testsuite/regression/ResultSetRegressionTest.java 2009-06-02 05:40:47 +0000
+++ b/src/testsuite/regression/ResultSetRegressionTest.java 2009-08-10 17:21:30 +0000
@@ -4883,4 +4883,41 @@ public class ResultSetRegressionTest ext
closeMemberJDBCResources();
}
}
+
+ public void testBug41484_2() throws Exception {
+ Connection cachedRsmdConn = getConnectionWithProps("cacheResultSetMetadata=true");
+
+ try {
+ createTable("bug41484", "(id int not null primary key, day date not null) DEFAULT CHARSET=utf8");
+ this.pstmt = cachedRsmdConn.prepareStatement("INSERT INTO bug41484(id, day) values(1, ?)");
+ this.pstmt.setInt(1, 20080509);
+ assertEquals(1, this.pstmt.executeUpdate());
+ this.pstmt.close();
+
+ this.pstmt = cachedRsmdConn.prepareStatement("SELECT * FROM bug41484 WHERE id = ?");
+ this.pstmt.setInt(1, 1);
+ this.rs = this.pstmt.executeQuery();
+ this.rs.first();
+ this.rs.getString("day");
+ this.rs.close();
+ this.pstmt.close();
+
+ this.pstmt = cachedRsmdConn.prepareStatement("INSERT INTO bug41484(id, day) values(2, ?)");
+ this.pstmt.setInt(1, 20090212);
+ assertEquals(1, this.pstmt.executeUpdate());
+ this.pstmt.close();
+
+ this.pstmt = cachedRsmdConn.prepareStatement("SELECT * FROM bug41484 WHERE id = ?");
+ this.pstmt.setInt(1, 2);
+ this.rs = this.pstmt.executeQuery();
+ this.rs.first();
+ assertEquals(this.rs.getString(1), "2");
+ this.rs.getString("day");
+ this.rs.close();
+
+ this.pstmt.close();
+ } finally {
+ cachedRsmdConn.close();
+ }
+ }
}
Attachment: [text/bzr-bundle] bzr/markm@sun.com-20090810172130-zjqou8tr1u2n9cjp.bundle
| Thread |
|---|
| • bzr push into connector-j/branches/branch_5_1 branch (markm:838 to 839)Bug#41484 | markm | 10 Aug |