You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Bernt M. Johnsen (JIRA)" <de...@db.apache.org> on 2006/01/04 22:18:01 UTC
[jira] Closed: (DERBY-794) setObject(col, BigDecimal, Types.NUMERIC) implies setObject(col, BigDecimal, Types.NUMERIC, 0)
[ http://issues.apache.org/jira/browse/DERBY-794?page=all ]
Bernt M. Johnsen closed DERBY-794:
----------------------------------
Resolution: Invalid
Dan is quite right. This is not a bug but defined behaviour.
> 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