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 "Kristian Waagan (Updated) (JIRA)" <ji...@apache.org> on 2012/04/18 19:40:39 UTC

[jira] [Updated] (DERBY-5489) getBinary() returns incorrect data after getObject() call on BLOB column

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

Kristian Waagan updated DERBY-5489:
-----------------------------------

    Attachment: derby-5489-1a-test.diff

Attaching a first version of a test as patch 1a. 

A few comments:
 o expects getBytes on BLOB and getString on CLOB to be supported
 o additionally, we support getString, getAsciiStream, and getCharacterStream on BLOB (note differing behavior regarding how the raw bytes are interpreted, see JDBC implementation notes on the Derby web site)
 o as an exception to the rule, multiple invocations of getString/getBytes is supported as long as no other getter has been invoked previously. This works because those getters always materialize. Do we want to keep this exception to the rule as a convenience, or should we go  for consistency?
 o the behavior between embedded and client differs on several accounts
                
> getBinary() returns incorrect data after getObject() call on BLOB column
> ------------------------------------------------------------------------
>
>                 Key: DERBY-5489
>                 URL: https://issues.apache.org/jira/browse/DERBY-5489
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.7.1.1, 10.8.2.2
>            Reporter: Pawel Fronczak
>              Labels: derby_triage10_9
>         Attachments: SelectBlobBug.java, derby-5489-1a-test.diff, repro.diff
>
>
> When ResultSet.getObject(int) is called on a BLOB column, the correct EmbedBlob object is returned. But if afterwards the ResultSet.getBytes(int) is called on the same row, the returned array contains invalid data - it is offset by 3 bytes and its size is incorrect.
> The problem only occurs when the stored BLOB is large enough to be internally represented by stream and not by array of bytes (at least ~32KiB).
> It seems that the getObject method shifts the stream position and therefore the getBytes method starts to read the data after the third byte, thus incorrectly calculating its length.

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