Re: BigDecimal Bugs

From: Barry Lind <barry(at)xythos(dot)com>
To: mailing-list(at)urbanet(dot)ch
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: BigDecimal Bugs
Date: 2002-03-25 22:34:06
Message-ID: 3C9FA5DE.8030208@xythos.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Patch applied. (also fixed jdbc1/PreparedStatement.java)

thanks,
--Barry

mailing-list(at)urbanet(dot)ch wrote:
> 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
>>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Jeremy 2002-03-26 04:41:04 server shutting down
Previous Message Barry Lind 2002-03-25 22:16:23 Re: Suggestion for an improvement... ("database" part missing