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 (JIRA)" <ji...@apache.org> on 2009/05/22 10:18:45 UTC

[jira] Updated: (DERBY-4241) Improve transition from read-only to writable Clob representation

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

Kristian Waagan updated DERBY-4241:
-----------------------------------

    Attachment: derby-4241-1a-InternalClob.getLengthIfKnown.diff

Patch 1a adds the method getLengthIfKnown to the InternalClob interface, and implements it in TemporaryClob and StoreStreamClob.

I expect to commit this shortly.
Patch ready for review.

> Improve transition from read-only to writable Clob representation
> -----------------------------------------------------------------
>
>                 Key: DERBY-4241
>                 URL: https://issues.apache.org/jira/browse/DERBY-4241
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.5.1.1, 10.6.0.0
>            Reporter: Kristian Waagan
>            Assignee: Kristian Waagan
>            Priority: Minor
>         Attachments: derby-4241-1a-InternalClob.getLengthIfKnown.diff
>
>
> When a store stream Clob is going to be modified, it will be written out to the temporary area of Derby and represented as a TemporaryClob.
> The transfer of the data is done in a sub-optimal manner for two reasons;
>  o for transfer of the complete Clob, the copy method operates on the byte level and we're not able to save the character length.
>  o for transfer of parts of the Clob (i.e. truncation), we have to first decode the UTF-8 encoding to find the byte count and then transfer the same bytes.
> I intend to do the following two changes;
>  1) Add a getCharLengthIfKnow-method to InternalClob.
>  2) Add a UTF-8 aware copy method to LOBStreamControl.
> When a complete Clob is to be copied, code like this will be executed;
>   cachedCharLength = internalClob.getLengthIfKnown();
>   if (cachedCharLength > 0)
>       // use existing byte-oriented copy method for best performance (copy until EOF)
>   else
>       cachedCharLength = control.copyUTF8Data()
> When parts of a Clob is to be copied, we always use the UTF-8 aware copy method, but we also do a cheap range check.
>   cachedCharLength = internalClob.getLengthIfKnown();
>   if (cachedCharLength > 0 && requestedLength > cachedCharLength)
>       throw EOFException();
>   if (cachedCharLength == requestedLength)
>      // use existing byte-oriented copy method for best performance (copy until EOF)
>   else
>       cachedCharLength = control.copyUTF8Data(requestedLength);
> Adding the UTF-8 aware copy method was started under DERBY-4023, including comments on the first revision of a patch.

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