Re: BigDecimal Bugs

From: <mailing-list(at)urbanet(dot)ch>
To: <Dave(at)micro-automation(dot)net>, <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: BigDecimal Bugs
Date: 2002-03-25 20:44:08
Message-ID: 20020325204418.39648475B02@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Sure! Here it is.

Index: Array.java
===================================================================
RCS file: /projects/cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Array.java,v
retrieving revision 1.9
diff -c -r1.9 Array.java
*** Array.java 2002/03/05 03:46:03 1.9
--- Array.java 2002/03/25 20:41:19
***************
*** 140,146 ****
case Types.NUMERIC:
retVal = new BigDecimal[ count ];
for ( ; count > 0; count-- )
! ((BigDecimal[])retVal)[i] = ResultSet.toBigDecimal( arrayContents[(int)index++], 0 );
break;
case Types.REAL:
retVal = new float[ count ];
--- 140,146 ----
case Types.NUMERIC:
retVal = new BigDecimal[ count ];
for ( ; count > 0; count-- )
! ((BigDecimal[])retVal)[i++] = ResultSet.toBigDecimal( arrayContents[(int)index++], 0 );
break;
case Types.REAL:
retVal = new float[ count ];
Index: PreparedStatement.java
===================================================================
RCS file: /projects/cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/PreparedStatement.java,v
retrieving revision 1.24
diff -c -r1.24 PreparedStatement.java
*** PreparedStatement.java 2002/01/15 07:37:33 1.24
--- PreparedStatement.java 2002/03/25 20:41:20
***************
*** 251,257 ****
*/
public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException
{
! set(parameterIndex, x.toString());
}

/*
--- 251,260 ----
*/
public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException
{
! if (x == null)
! setNull(parameterIndex, Types.OTHER);
! else
! set(parameterIndex, x.toString());
}

/*

On Monday 25 March 2002 02:50, Dave Cramer wrote:
> Florian,
>
> Can you resubmit these patches as context diff's ?
>
> cvs -c diff ...
>
> Thanks,
>
> Dave
>
> > -----Original Message-----
> > From: pgsql-jdbc-owner(at)postgresql(dot)org
> > [mailto:pgsql-jdbc-owner(at)postgresql(dot)org] On Behalf Of
> > mailing-list(at)urbanet(dot)ch
> > Sent: Sunday, March 24, 2002 11:02 AM
> > To: pgsql-jdbc(at)postgresql(dot)org
> > Subject: [JDBC] BigDecimal Bugs
> >
> >
> > Hi,
> >
> > I've found 2 bugs related with BigDecimal in the JDBC driver.
> >
> > The first bug occurs when you call Array.toArray on a column
> > containing an
> > array of NUMERIC. The returned java array is wrong with all
> > BigDecimal
> > stored in the first element.
> >
> > The second bug is in PreparedStatement.setBigDecimal. If you
> > pass a null
> > object as argument, the method raises a NullPointerException.
> >
> > Attached are the 2 diff files to correct those bugs.
> >
> > Kudos to all postgresql developers for their great job!
> >
> > Florian

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Barry Lind 2002-03-25 22:16:23 Re: Suggestion for an improvement... ("database" part missing
Previous Message Dave Cramer 2002-03-25 20:41:27 Re: Two Phase commits