]> granicus.if.org Git - postgresql/commitdiff
applied patch submitted by Florian (mailing-list@urbanet.ch) for BigDecimal support
authorBarry Lind <barry@xythos.com>
Tue, 26 Mar 2002 06:33:21 +0000 (06:33 +0000)
committerBarry Lind <barry@xythos.com>
Tue, 26 Mar 2002 06:33:21 +0000 (06:33 +0000)
src/interfaces/jdbc/org/postgresql/jdbc1/PreparedStatement.java
src/interfaces/jdbc/org/postgresql/jdbc2/Array.java
src/interfaces/jdbc/org/postgresql/jdbc2/PreparedStatement.java

index 31bbaf2eecec3128228693daeb0a15357f01fcb2..7084887cfd7380f13db460165e4570e473bd2fef 100644 (file)
@@ -243,7 +243,12 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
         */
        public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException
        {
-               set(parameterIndex, x.toString());
+               if (x == null)
+                       setNull(parameterIndex, Types.OTHER);
+               else
+               {
+                   set(parameterIndex, x.toString());
+               }
        }
 
        /*
index f68106ee7b6958b429642430202e20bb1343f2dd..75391411527c2a03a2f7812679ada42fe17e1dab 100644 (file)
@@ -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 ];
index 49c5f2da804e8eb72617e6a9f9e09af7ef252ee1..d0c07718bdbcf33d9bbf2ebace4c1f99e510c17c 100644 (file)
@@ -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());
+           }
        }
 
        /*