db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kathey Marsden (JIRA)" <j...@apache.org>
Subject [jira] Updated: (DERBY-3126) Inserting BigDecimal value in PreparedStatement with setBigDecimal into double column loses fractional digits
Date Thu, 11 Oct 2007 22:59:50 GMT

     [ https://issues.apache.org/jira/browse/DERBY-3126?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Kathey Marsden updated DERBY-3126:
----------------------------------

    Attachment: derby-2073_stat.txt
                derby-2073_diff.txt

Attached is a patch for DERBY-2073.  The change changes NetStatementRequest.computeProtocolTypesAndLengths
to always look at the data scale and precision when sending decimal values to the server rather
than using the parameterMetaData values which are never set. For null values it just uses
scale 0 and precision 1. For non-null values I used the pre-existing  Utils.computeBigDecimalPrecision
method to compute precision.


Getting the scale and precision from the data is the only way to make sure the server gets
the actual data value set by the user.  There was some talk in the old comments about scale
and  precision for output and inout parameters but as far as I can tell the scale set with
registerOutputParameter is not saved anywhere, so cannot be used here.   I don't think it
makes sense use the output scale for the input parameter as it might affect the value sent
to the server.  There may be additional issues with output parameter and registerOutputParameter,
specifying a scale, since we don't seem to use the scale anywhere.  I filed DERBY-3125 for
the lack of use of the scale parameter in registerOutputParameter for both embedded and client.

I added a test to ParameterMappingTest which was only testing whole numbers for decimal values.

I also noticed that setObject with big decimal and specified scale has a similar issue, but
it is not fixed by this patch. I filed DERBY-3127 for that.


tests are running ...



Kathey



> Inserting BigDecimal value in PreparedStatement with setBigDecimal into double column
loses fractional digits
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3126
>                 URL: https://issues.apache.org/jira/browse/DERBY-3126
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC, Network Client
>            Reporter: Kathey Marsden
>         Attachments: derby-2073_diff.txt, derby-2073_stat.txt
>
>
> Splitting this issue into two subtasks one for setBigDecimal and one for setObject as
they take a different code path and I plan to submit separate patches. Reproduces with BigDecimalProblemTester
attached to DERBY-2073

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message