From da631e931f9da4bc5df4bfd39f0c42684adfb8e5 Mon Sep 17 00:00:00 2001 From: Barry Lind Date: Tue, 26 Mar 2002 06:33:21 +0000 Subject: applied patch submitted by Florian (mailing-list@urbanet.ch) for BigDecimal support --- src/interfaces/jdbc/org/postgresql/jdbc2/Array.java | 2 +- src/interfaces/jdbc/org/postgresql/jdbc2/PreparedStatement.java | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src/interfaces/jdbc/org/postgresql/jdbc2') diff --git a/src/interfaces/jdbc/org/postgresql/jdbc2/Array.java b/src/interfaces/jdbc/org/postgresql/jdbc2/Array.java index f68106ee7b6..75391411527 100644 --- a/src/interfaces/jdbc/org/postgresql/jdbc2/Array.java +++ b/src/interfaces/jdbc/org/postgresql/jdbc2/Array.java @@ -140,7 +140,7 @@ public class Array implements java.sql.Array case Types.NUMERIC: retVal = new BigDecimal[ count ]; for ( ; count > 0; count-- ) - ((BigDecimal[])retVal)[i] = ResultSet.toBigDecimal( arrayContents[(int)index++], 0 ); + ((BigDecimal[])retVal)[i++] = ResultSet.toBigDecimal( arrayContents[(int)index++], 0 ); break; case Types.REAL: retVal = new float[ count ]; diff --git a/src/interfaces/jdbc/org/postgresql/jdbc2/PreparedStatement.java b/src/interfaces/jdbc/org/postgresql/jdbc2/PreparedStatement.java index 49c5f2da804..d0c07718bdb 100644 --- a/src/interfaces/jdbc/org/postgresql/jdbc2/PreparedStatement.java +++ b/src/interfaces/jdbc/org/postgresql/jdbc2/PreparedStatement.java @@ -251,7 +251,11 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta */ public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException { + if (x == null) { + setNull(parameterIndex, Types.OTHER); + } else { set(parameterIndex, x.toString()); + } } /* -- cgit v1.2.3