Skip to content

Commit 30c2b5e

Browse files
author
Barry Lind
committed
Applied patch submitted by Kris Jurka to result in a better error message
under some circumstances and handle negative money values better. Modified Files: jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSet.java
1 parent 78b13fe commit 30c2b5e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSet.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import org.postgresql.util.PGbytea;
1414
import org.postgresql.util.PSQLException;
1515

16-
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1ResultSet.java,v 1.6 2002/09/06 21:23:06 momjian Exp $
16+
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1ResultSet.java,v 1.7 2002/10/19 22:10:36 barry Exp $
1717
* This class defines methods of the jdbc1 specification. This class is
1818
* extended by org.postgresql.jdbc2.AbstractJdbc2ResultSet which adds the jdbc2
1919
* methods. The real ResultSet class (for jdbc1) is org.postgresql.jdbc1.Jdbc1ResultSet
@@ -646,6 +646,10 @@ public String getFixedString(int col) throws SQLException
646646
if (wasNullFlag)
647647
return null;
648648

649+
// if we don't have at least 2 characters it can't be money.
650+
if (s.length() < 2)
651+
return s;
652+
649653
// Handle Money
650654
if (s.charAt(0) == '(')
651655
{
@@ -655,6 +659,10 @@ public String getFixedString(int col) throws SQLException
655659
{
656660
s = s.substring(1);
657661
}
662+
else if (s.charAt(0) == '-' && s.charAt(1) == '$')
663+
{
664+
s = "-" + s.substring(2);
665+
}
658666

659667
return s;
660668
}

0 commit comments

Comments
 (0)