db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Øystein Grøvlen (JIRA) <j...@apache.org>
Subject [jira] Commented: (DERBY-2604) Implement Clob support for locators
Date Wed, 09 May 2007 11:49:15 GMT

    [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12494481
] 

Øystein Grøvlen commented on DERBY-2604:
----------------------------------------

>     [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12494462
] 
> 
> V.Narayanan commented on DERBY-2604:
> ------------------------------------
> 
>> 1) readBytes() doesn't look correct to me. It takes a len parameter, 
>> which is length in bytes, and passes it on to clobGetSubString(), which 
>> expects length in characters. This means that the byte array returned 
>> by readBytes() might contain more bytes than len. I cannot see that 
>> read() or read(byte[],int,int) are prepared for this.
> 
> I agree. I should have taken care of this while submitting the patch.
> I intend to allow the code top remain the same way except to change the
> code after doing
> 
> String resultStr = connection.locatorProcedureCall().
>                     clobGetSubString(clob.getLocator(),
>                     currentPos, actualLength);
> 
> we know that when we do a resultStr.getBytes we would get more
> Bytes than actualLength. So from resultStr.getBytes I need to get
> only actualLength number of Bytes.
> 
> In this conversion from String to Bytes I intend to use the method
> getBytesFromString in ClobStreamControl  for the same reasons
> the method was used in Derby-2346.

I am not quite following the discussion here.  This stream is returned
from Clob.getAsciiStream().  Since it is ASCII, I would think that it
should always return one byte per character.  I would have thought
that you should do the same as AsciiStream which has the following
code for the conversion:

    public int read() throws java.io.IOException {
        int oneChar = reader_.read();
        ++charsRead_;
        if (oneChar != -1) // if not eos
        {
            if(oneChar <= 0x00ff)
                return oneChar;
            else
                return 0x003f;
        } else {
            return -1; // end of stream
        }
    }

(This implementation is actually an example of implementing the stream
by wrapping it in the Reader.)


> Implement Clob support for locators
> -----------------------------------
>
>                 Key: DERBY-2604
>                 URL: https://issues.apache.org/jira/browse/DERBY-2604
>             Project: Derby
>          Issue Type: Sub-task
>          Components: Network Server
>            Reporter: V.Narayanan
>         Assigned To: V.Narayanan
>         Attachments: ClobLocatorWork_v1.diff, ClobLocatorWork_v1.stat
>
>


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


Mime
View raw message