Commit 30c2b5ec authored by Barry Lind's avatar Barry Lind

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
parent 78b13fee
...@@ -13,7 +13,7 @@ import org.postgresql.largeobject.*; ...@@ -13,7 +13,7 @@ import org.postgresql.largeobject.*;
import org.postgresql.util.PGbytea; import org.postgresql.util.PGbytea;
import org.postgresql.util.PSQLException; import org.postgresql.util.PSQLException;
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1ResultSet.java,v 1.6 2002/09/06 21:23:06 momjian Exp $ /* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1ResultSet.java,v 1.7 2002/10/19 22:10:36 barry Exp $
* This class defines methods of the jdbc1 specification. This class is * This class defines methods of the jdbc1 specification. This class is
* extended by org.postgresql.jdbc2.AbstractJdbc2ResultSet which adds the jdbc2 * extended by org.postgresql.jdbc2.AbstractJdbc2ResultSet which adds the jdbc2
* methods. The real ResultSet class (for jdbc1) is org.postgresql.jdbc1.Jdbc1ResultSet * methods. The real ResultSet class (for jdbc1) is org.postgresql.jdbc1.Jdbc1ResultSet
...@@ -646,6 +646,10 @@ public abstract class AbstractJdbc1ResultSet ...@@ -646,6 +646,10 @@ public abstract class AbstractJdbc1ResultSet
if (wasNullFlag) if (wasNullFlag)
return null; return null;
// if we don't have at least 2 characters it can't be money.
if (s.length() < 2)
return s;
// Handle Money // Handle Money
if (s.charAt(0) == '(') if (s.charAt(0) == '(')
{ {
...@@ -655,6 +659,10 @@ public abstract class AbstractJdbc1ResultSet ...@@ -655,6 +659,10 @@ public abstract class AbstractJdbc1ResultSet
{ {
s = s.substring(1); s = s.substring(1);
} }
else if (s.charAt(0) == '-' && s.charAt(1) == '$')
{
s = "-" + s.substring(2);
}
return s; return s;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment