[ http://issues.apache.org/jira/browse/DERBY-794?page=comments#action_12361768 ]
Daniel John Debrunner commented on DERBY-794: --------------------------------------------- Why is this a bug, it's the defined behaviour for setObject? > setObject(col, BigDecimal, Types.NUMERIC) implies setObject(col, BigDecimal, > Types.NUMERIC, 0) > ---------------------------------------------------------------------------------------------- > > Key: DERBY-794 > URL: http://issues.apache.org/jira/browse/DERBY-794 > Project: Derby > Type: Bug > Components: JDBC > Reporter: Bernt M. Johnsen > Assignee: Bernt M. Johnsen > > setObject(col, BigDecimal, Types.NUMERIC) implies setObject(col, > BigDecimal,Types.NUMERIC , 0) and the result is stored with no digits > to the right of the decimal point. > thus (given the SQL type NUMERIC(10,2) the following occurs: > setBigDecimal(col, new BigDecimal("1.9999")) gives 1.99 (OK > setObject(col, new BigDecimal("1.9999"), Types.NUMERIC) gives 1.00 (WRONG) > setObject(col, new BigDecimal("1.9999"), Types.NUMERIC, 4) gives 1.99 (OK) > This also applies to Types.DECIMAL > The problem is that "unspecified scale" is translated to zero in > 1) org/apache/derby/impl/jdbc/EmbedPreparedStatement: > /** > * This method is like setObject above, but assumes a scale of zero. > * @exception SQLException thrown on failure. > */ > public final void setObject(int parameterIndex, Object x, int > targetSqlType) > throws SQLException { > setObject(parameterIndex, x, targetSqlType, 0); > } > and 2) org/apache/derby/client/am/PreparedStatement: > public void setObject(int parameterIndex, Object x, int targetJdbcType) > throws SqlException { > synchronized (connection_) { > if (agent_.loggingEnabled()) { > agent_.logWriter_.traceEntry(this, "setObject", > parameterIndex, x, targetJdbcType); > } > setObjectX(parameterIndex, x, targetJdbcType, 0); > } > } -- 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
