db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kristian Waagan (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (DERBY-3646) Embedded returns wrong results when selecting a blob column twice and using getBinaryStream()
Date Thu, 11 Feb 2010 12:24:28 GMT

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

Kristian Waagan resolved DERBY-3646.

       Resolution: Fixed
    Fix Version/s:

There are a few extra pieces of information for this issue:
 - Dag discovered a problem with the repro and also a bug in Derby, see his comments on DERBY-447
and the bug reported as DERBY-4521.
 - wrt the list above Derby now allows items a, b, and c. I think options d and e are disallowed
by JDBC and the following statement from the getBinaryStream JavaDoc:
    "Note: All the data in the returned stream must be read prior to getting the value of
any other column. The next call to a getter method implicitly closes the stream. Also, a stream
may return 0 when the method InputStream.available  is called whether there is data available
or not."

    I think we could implement d if we wanted to, and maybe even e - but the latter would
probably come with a performance hit. Since JDBC seems to disallow these behaviors, disallowing
them in Derby seems like a good approach to me.
 - if DERBY-3844 patch 1a is committed, you are only allowed to call get[BC]lob once on a
column per row. In this case the LOB object isn't closed / freed on the next getX-call.

Fixed by the combination of DERBY-4477 and DERBY-4520.
Verified against trunk revision 980933, but it would be nice if the reporter verified the
fix as well.

I do not plan to back-port the fix(es) due to the rather signficant changes involved, but
it may be technically possible. 

> Embedded returns wrong results when selecting a blob column twice and using getBinaryStream()
> ---------------------------------------------------------------------------------------------
>                 Key: DERBY-3646
>                 URL: https://issues.apache.org/jira/browse/DERBY-3646
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions:,,,,
>            Reporter: Kathey Marsden
>             Fix For:
>         Attachments: DoubleSelect.java
> The attached program DoubleSelect selects a blob column twice and tries to access the
blob column with getBinaryStream.
> With embedded the output is:
> 4 5 6 7 8 9 10 11 12 13
> 14 15 16 17 18 19 20 21 22 23
> I am done
> Two things seem to be happening with embedded.
> 1) Both getBinaryStream() calls are returning the same stream.
> 2) The second getBinaryStream() call throws away 4 bytes.
> With client the output is:
> Exception in thread "main" java.io.IOException: The object is already
> closed.
>         at
> org.apache.derby.client.am.CloseFilterInputStream.read(CloseFilterInputStream.java:50)
>         at DoubleSelect.printNextTen(DoubleSelect.java:53)
>         at DoubleSelect.main(DoubleSelect.java:43)
> 0 1 2 3 4 5 6 7 8 9
> So with client it looks like the  second getBinaryStream() call closes
> the first stream but then returns the right result for the second stream.
> Perhaps embedded should behave the same as client or perhaps the query should just work.
 Regardless embedded should not return wrong results.

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

View raw message