Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd42f9b5

Browse files
committed
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 wasnot quite fixed in 7.0.2. absolute would stop the user form moving to thefirst record (record 0 internally).2. Absolute did not set current_row3. For field.mod=-1, GetObject would try to return numeric values with aprecision of around 65000. Now GetObject detects when field.mod==-1, andpasses that as the scale to getBigDecimal. getBigDecimal detects when a-1 is passed and simply does not scale the value returned. You still getthe correct value back, it simply does not tweak the precision.I'm working off of a source tree I just checked out from therepository. The diff is based on what was in the repository about tenminutes ago.----------------------------------------------------------------Travis Bauer | CS Grad Student | IU |www.cs.indiana.edu/~trbauer----------------------------------------------------------------
1 parent00156fa commitd42f9b5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

‎src/interfaces/jdbc/org/postgresql/jdbc2/ResultSet.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException
347347
}catch (NumberFormatExceptione) {
348348
thrownewPSQLException ("postgresql.res.badbigdec",s);
349349
}
350+
if (scale==-1)returnval;
350351
try
351352
{
352353
returnval.setScale(scale);
@@ -739,7 +740,8 @@ public Object getObject(int columnIndex) throws SQLException
739740
caseTypes.BIGINT:
740741
returnnewLong(getLong(columnIndex));
741742
caseTypes.NUMERIC:
742-
returngetBigDecimal(columnIndex, ((field.mod-4) &0xffff));
743+
returngetBigDecimal
744+
(columnIndex, (field.mod==-1)?-1:((field.mod-4) &0xffff));
743745
caseTypes.REAL:
744746
returnnewFloat(getFloat(columnIndex));
745747
caseTypes.DOUBLE:
@@ -804,9 +806,10 @@ public boolean absolute(int index) throws SQLException
804806
if(index<0)
805807
index=rows.size()+index;
806808

807-
if (index==0 ||index >rows.size())
809+
if (index >rows.size())
808810
returnfalse;
809811

812+
current_row=index;
810813
this_row = (byte [][])rows.elementAt(index);
811814
returntrue;
812815
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp