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

Anurag Shekhar updated DERBY-2712:
----------------------------------

    Attachment: derby-2712.diff

I have modified EmbedClob.getCharacterStream to return ClobUpdateableReader. 
ClobUpdateableReader is modifed to detect if the Clob has moved from Readonly 
InternalClob to a writable InternalClob. If the EmbedClob moves from readonly 
mode to writable mode it fetches the input stream again from the EmbedClob and 
skips to the current position.
Code to invalidate the internal Reader in case the underlying stream is 
modified was already part of this Reader.

Updated files
java/engine/org/apache/derby/impl/jdbc/EmbedClob.java
Added two methods
        isWritable
                ClobUpdateableReader uses this methods to determine if the Clob 
has swtched from a readonly InternalClob to a writable InternalClob.
        getInternalStream
                ClobUpdateableReader uses this method if it detects Clob is 
modified since creating ClobUpdateableReader.
        
Modified getCharacterStream() to return ClobUpdateableReader.

java/engine/org/apache/derby/impl/jdbc/ClobUpdateableReader.java

added a new constructor. This constructor will be used by EmbedClob. It accepts 
Clob as a parameter Clob object is used to check if the InternalClob its using 
is writable or not. In case it was read only in the begning 
ClobUpdateableReader uses getInternalStream to refresh the stream after it 
switches to writable InternalClob.

Added a new private method updateIfRequired which is called in every method to 
check if the underlying stream has changed.

java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ClobUpdateableReaderTest.java

Added a new test for switching from StoreStream to ClobStreamControl.



> If large clob is updated after Reader. the reader continues to point to old 
> data
> --------------------------------------------------------------------------------
>
>                 Key: DERBY-2712
>                 URL: https://issues.apache.org/jira/browse/DERBY-2712
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.3.0.0
>            Reporter: Anurag Shekhar
>         Attachments: derby-2712.diff
>
>
> If a Reader is fetched from a large clob (obtained from ResultSet) a reader 
> linked to the dvd stream is returned once a set method is called on it the 
> clob data is materialized in control class but the Reader returned previously 
> continues to point to old data.

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

Reply via email to