db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kathey Marsden (JIRA)" <derby-...@db.apache.org>
Subject [jira] Resolved: (DERBY-250) With client setObject( parameterIndex, x, java.sql.DOUBLE) throws conversion exception if the object passed is a BigDecimal with more than 31 digits
Date Fri, 13 May 2005 23:51:05 GMT
     [ http://issues.apache.org/jira/browse/DERBY-250?page=all ]
     
Kathey Marsden resolved DERBY-250:
----------------------------------

    Resolution: Fixed

This issue was fixed with svn r167863

Below are the patch comments.

This is a patch for Derby-250 to eliminate the conversion error when a
BigDecimal with more than 31 digits is  passed to setObject  with a targetSqlType.
public void setObject(int parameterIndex,
                      Object x,
                      int targetSqlType)
               throws SQLException
or
public void setObject(int parameterIndex,
                      Object x,
                      int targetSqlType,
                      int scale)
               throws SQLException

The approach of the patch is to have setObject calls with a targetSqlType  to always convert
before sending to the value to the server for all types.

Taking this approach exposed other issues with  the client's conversion mechanism for Date,
Time and Timestamp, which were customized valueOf  methods to support ISO format.   Since
the extended format is not needed for Derby, I replaced these with the
standard <Date|Time|TimeStamp>.valueOf calls.

The patch also fixes issues with scale getting set properly when specified for these calls.


> With client setObject( parameterIndex, x, java.sql.DOUBLE) throws conversion exception
if the object passed is a BigDecimal with more than 31 digits
> ----------------------------------------------------------------------------------------------------------------------------------------------------
>
>          Key: DERBY-250
>          URL: http://issues.apache.org/jira/browse/DERBY-250
>      Project: Derby
>         Type: Bug
>   Components: Network Client
>     Versions: 10.1.0.0
>     Reporter: Kathey Marsden
>     Assignee: Kathey Marsden
>      Fix For: 10.1.0.0

>
> Trying to insert a  BigDecimal value with unscaled value longer than 31 digits using

> public void setObject(int parameterIndex,
>                       Object x,
>                       int targetSqlType)
>                throws SQLException
> or 
> public void setObject(int parameterIndex,
>                       Object x,
>                       int targetSqlType,
>                       int scale)
>                throws SQLException
> fails with Network client.
> ps.setObject(1,1000000000000000000000000000000000000000000000000
> 0000000000000000000000000000000000000000000000000000000000000000
> 0000000000000,java.sql.Types.DOUBLE)
> org.apache.derby.client.am.ConversionException: [converters] 
> The numeric literal 
> "100000000000000000000000000000000000000000000000000000000000000
> 0000000000000000000000000000000000000000000000000000000
> 00000000" is not valid because its value is out of range.
>         at 
> org.apache.derby.client.am.Decimal.bigDecimalToPackedDecimalByte
> s(Decimal.java:391)
>         at 
> org.apache.derby.client.net.Request.writeBigDecimal(Request.java
> :1632)
>         at 
> org.apache.derby.client.net.NetStatementRequest.buildFDODTA(NetS
> tatementRequest.java:692)
>         at 
> org.apache.derby.client.net.NetStatementRequest.buildSQLDTAcomma
> ndData(NetStatementRequest.java:514)
>         at 
> org.apache.derby.client.net.NetStatementRequest.writeExecute(Net
> StatementRequest.java:137)
>         at 
> org.apache.derby.client.net.NetPreparedStatement.writeExecute_(N
> etPreparedStatement.java:124)
>         at 
> org.apache.derby.client.am.PreparedStatement.writeExecute(Prepar
> edStatement.java:956)
>         at 
> org.apache.derby.client.am.PreparedStatement.flowExecute(Prepare
> dStatement.java:1173)
>         at 
> org.apache.derby.client.am.PreparedStatement.executeUpdateX(Prep
> aredStatement.java:324)
>         at 
> org.apache.derby.client.am.PreparedStatement.executeUpdate(Prepa
> redStatement.java:315)
> See attached patch with modified prepStmt.java test for reproduction.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message