[ 
https://issues.apache.org/jira/browse/DERBY-5546?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13174681#comment-13174681
 ] 

Knut Anders Hatlen commented on DERBY-5546:
-------------------------------------------

Thanks for running these experiments, Dag. It's an interesting find that 
embedded uses Math.floor() for the conversion in updateDouble(). That means 
-0.1 gets converted to -1 on embedded, whereas it's converted to 0 on the 
client. The conversion on the client sounds more intuitive to me in this case.

When using PreparedStatement.setDouble() on an INT column, both drivers agree 
that -0.1 should be converted to -1 (probably because the client sends it as a 
floating point value across the wire and lets the server do the conversion).

However, when invoking ResultSet.getInt() on a REAL column, both drivers 
convert -0.1 to 0. And CAST(-0.1 AS INT) also evaluates to 0.
                
> ResultSet#updateBigDecimal on a REAL column does not do underflow checking
> --------------------------------------------------------------------------
>
>                 Key: DERBY-5546
>                 URL: https://issues.apache.org/jira/browse/DERBY-5546
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.8.2.2
>            Reporter: Dag H. Wanvik
>            Priority: Minor
>         Attachments: MissingUnderflowCheck.java, derby-5546.diff, 
> derby-5546.stat
>
>
> In contrast, ResultSet#updateBigDecimal on a FLOAT or DOUBLE column gives the 
> expected error on underflow. Cf. the attached repro program 
> MissingUnderflowCheck.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to