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

Anurag Shekhar updated DERBY-2800:
----------------------------------

    Attachment: derby-2800.diff

ClobStreamControl provides most the the method required to implement 
Clob.truncate. This patch does implements a few new methods for efficiency.

File Modified

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

*  makeWritableClobClone (long length) 
   This is a  new overload  of  makeWritableClobClone. This method is to avoid 
copying entire StoreStreamClob to ClobStreamControl and then performing 
truncate on it. This methods calls out the similar new method 
ClobStreamControl.cloneClobContent to copy specified number of char to the new 
InternalClob.

* truncate (long len)
  Removed notImplimented Exception. Calling makeWritableClobClone in case of 
StoreStreamClob and InternalClob.truncate in case of writable clob.

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

* copyClobContent(InternalClob clob, long length)
   This is a new method which creates a new Internal copy with only part of the 
clob. It copies length chars to the new InternalClob

* cloneClobContent(String dbName,
                                         ConnectionChild conChild,
                                         InternalClob clob,
                                         long length)
This new overload calls out new copyClobContent to make a clone with only part 
of the clob data.

*truncate (long)
  This method had a small bug. It was treating the parameter as byte length but 
the doc says its char length. Added code to convert it into byte length.

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

*copyData (InputStream, long)
Modified to take care of stream.read when the read bytes are lesser than number 
bytes asked for.
java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ClobTruncateTest.java

Added a new test suite to test Clob.truncate. Right now its enabled for 
embedded driver only as the length chaching on network client causes length 
check to fail after truncate.
java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/_Suite.java

added entry for 
java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ClobTruncateTest.java



 




> Implement Clob.truncate for embedded driver
> -------------------------------------------
>
>                 Key: DERBY-2800
>                 URL: https://issues.apache.org/jira/browse/DERBY-2800
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.3.0.0
>            Reporter: Anurag Shekhar
>            Assignee: Anurag Shekhar
>         Attachments: derby-2800.diff
>
>


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