diff options
author | Bruce Momjian <bruce@momjian.us> | 2000-06-07 20:01:20 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2000-06-07 20:01:20 +0000 |
commit | d42f9b59e93f5b85cb1f7b31f192e8acebfa1e12 (patch) | |
tree | 831b246e544850fe46f6d756c531be2fe2170f1a | |
parent | 00156fa241a62394f60175253da135abf5e0ba62 (diff) | |
download | postgresql-d42f9b59e93f5b85cb1f7b31f192e8acebfa1e12.tar.gz postgresql-d42f9b59e93f5b85cb1f7b31f192e8acebfa1e12.zip |
Here is a patch for interfaces/jdbc/org/postgresql/jdbc2/ResultSet.java
It addresses three issues:
1. The problem with ResultSet's interface specifying 1-based indexing was
not quite fixed in 7.0.2. absolute would stop the user form moving to the
first record (record 0 internally).
2. Absolute did not set current_row
3. For field.mod=-1, GetObject would try to return numeric values with a
precision of around 65000. Now GetObject detects when field.mod==-1, and
passes that as the scale to getBigDecimal. getBigDecimal detects when a
-1 is passed and simply does not scale the value returned. You still get
the correct value back, it simply does not tweak the precision.
I'm working off of a source tree I just checked out from the
repository. The diff is based on what was in the repository about ten
minutes ago.
----------------------------------------------------------------
Travis Bauer | CS Grad Student | IU |www.cs.indiana.edu/~trbauer
----------------------------------------------------------------
-rw-r--r-- | src/interfaces/jdbc/org/postgresql/jdbc2/ResultSet.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc2/ResultSet.java b/src/interfaces/jdbc/org/postgresql/jdbc2/ResultSet.java index bcde5043b72..1b957bd9cbf 100644 --- a/src/interfaces/jdbc/org/postgresql/jdbc2/ResultSet.java +++ b/src/interfaces/jdbc/org/postgresql/jdbc2/ResultSet.java @@ -347,6 +347,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu } catch (NumberFormatException e) { throw new PSQLException ("postgresql.res.badbigdec",s); } + if (scale==-1) return val; try { return val.setScale(scale); @@ -739,7 +740,8 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu case Types.BIGINT: return new Long(getLong(columnIndex)); case Types.NUMERIC: - return getBigDecimal(columnIndex, ((field.mod-4) & 0xffff)); + return getBigDecimal + (columnIndex, (field.mod==-1)?-1:((field.mod-4) & 0xffff)); case Types.REAL: return new Float(getFloat(columnIndex)); case Types.DOUBLE: @@ -804,9 +806,10 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu if(index<0) index=rows.size()+index; - if (index==0 || index > rows.size()) + if (index > rows.size()) return false; + current_row=index; this_row = (byte [][])rows.elementAt(index); return true; } |