db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Anders Hatlen (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DERBY-5546) ResultSet#updateBigDecimal on a REAL column does not do underflow checking
Date Thu, 22 Dec 2011 08:14:30 GMT

    [ 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:
>            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


View raw message