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 "V.Narayanan (JIRA)" <ji...@apache.org> on 2007/05/03 14:35:15 UTC

[jira] Created: (DERBY-2604) Implement Clob support for locators

Implement Clob support for locators
-----------------------------------

                 Key: DERBY-2604
                 URL: https://issues.apache.org/jira/browse/DERBY-2604
             Project: Derby
          Issue Type: Sub-task
            Reporter: V.Narayanan




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


[jira] Commented: (DERBY-2604) Implement Clob support for locators

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12493971 ] 

V.Narayanan commented on DERBY-2604:
------------------------------------

Thanx a ton for the commit on this issue Rick.

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


[jira] Commented: (DERBY-2604) Implement Clob support for locators

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12494262 ] 

Knut Anders Hatlen commented on DERBY-2604:
-------------------------------------------

Thanks Narayanan! You might also want to check whether some of the comments above are valid for the other ClobLocator streams/readers/writers.

I noticed that ClobLocator{Reader,Writer} check whether the object is closed, whereas ClobLocator{Input,Output}Stream don't. Is there any reason for this?

ClobLocatorOutputStream.writeBytes() has this line:
    String clobStr = new String(b);
Should it also have specified the encoding?

Perhaps it would be easier to make ClobLocatorInputStream a wrapper around ClobLocatorReader, and ClobLocatorOutputStream a wrapper around ClobLocatorWriter?

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


[jira] Commented: (DERBY-2604) Implement Clob support for locators

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12493359 ] 

V.Narayanan commented on DERBY-2604:
------------------------------------

DERBY-2347 adds the possibility to send locators between client and server instead of LOB values. 

DERBY-2496 adds locator support to Blobs

On the same lines we need to add locator support for Clobs also.

The changes that will be done as part of this issue will cover most of the locator work that would need be done with respect to Clobs.

As already discussed in the JIRA issue that was raised for PreparedStatements and CallableStatements(https://issues.apache.org/jira/browse/DERBY-2529) 
there are no changes needed here related to Clob also.

A similar case would exist for ResultSets also since the LOB in this case is also B-Layer streamed and there would be no significant improvement with using locators.

Connection.createClob() will use the constructor that would be introduced in this patch which accepts a locator as a parameter to return an empty Clob.

The locators will not be enabled with this patch.

A seperate issue will be raised to enable locators and handle test failures that might result because of that.

> Implement Clob support for locators
> -----------------------------------
>
>                 Key: DERBY-2604
>                 URL: https://issues.apache.org/jira/browse/DERBY-2604
>             Project: Derby
>          Issue Type: Sub-task
>            Reporter: V.Narayanan
>


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


[jira] Updated: (DERBY-2604) Implement Clob support for locators

Posted by "Myrna van Lunteren (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Myrna van Lunteren updated DERBY-2604:
--------------------------------------

    Fix Version/s: 10.3.0.0

> 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
>            Assignee: V.Narayanan
>             Fix For: 10.3.0.0
>
>         Attachments: ClobLocatorWork_v1.diff, ClobLocatorWork_v1.stat, ClobLocatorWork_v2.diff, ClobLocatorWork_v2.stat, ClobLocatorWork_v3.diff, ClobLocatorWork_v3.stat, ClobLocatorWork_v4.diff, ClobLocatorWork_v4.stat, ClobLocatorWork_v5.diff, ClobLocatorWork_v5.stat, ConnectionLocatorWork_v2.diff, ConnectionLocatorWork_v4.diff
>
>


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


[jira] Commented: (DERBY-2604) Implement Clob support for locators

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12495171 ] 

Knut Anders Hatlen commented on DERBY-2604:
-------------------------------------------

Committed revision 537291.

> 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, ClobLocatorWork_v2.diff, ClobLocatorWork_v2.stat, ClobLocatorWork_v3.diff, ClobLocatorWork_v3.stat, ConnectionLocatorWork_v2.diff
>
>


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


[jira] Updated: (DERBY-2604) Implement Clob support for locators

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

V.Narayanan updated DERBY-2604:
-------------------------------

    Attachment: ClobLocatorWork_v5.stat
                ClobLocatorWork_v5.diff

This patch addresses the bugs that were found during the process of enabling 
Clob support for locators. It contains within itself the changes made in v4
and the changes as explained in the comments above.

The following are the details of the details of the files modified and their
import apropos the context.

M      java/client/org/apache/derby/client/am/ClobLocatorWriter.java

writeCharacters(line no 162) method was using c.length as the length of the string
transmitted to the server using the clobSetString stored procedure. This should
use len instead.

M      java/client/org/apache/derby/client/am/Clob.java

The PositionX method on the client that accepts a Clob had not been converted to use 
locators. This has been done.

Added buffering for InputStreams by wrapping ClobLocatorInputStream in
a BufferedInputStream and ClobLocatorReader in a BufferedReader.

M      java/client/org/apache/derby/client/am/CallableLocatorProcedures.java

The stored procedure call to CLOBGETPOSITIONFROMSTRING was sending the original string 
instead of sending it in chunks. This has been changed to send the chunks instead
(stringToBeCompared).

M      java/client/org/apache/derby/client/am/ClobLocatorInputStream.java
M      java/client/org/apache/derby/client/am/ClobLocatorReader.java

Converted the locator streams to use maxPos in the same way this is done
in BlobLocatorInputStream.

I have not run junit All on the patch yet. I will run the tests and revert back with
the results.

Please consider v5 for reviews and comments.

> 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, ClobLocatorWork_v2.diff, ClobLocatorWork_v2.stat, ClobLocatorWork_v3.diff, ClobLocatorWork_v3.stat, ClobLocatorWork_v4.diff, ClobLocatorWork_v4.stat, ClobLocatorWork_v5.diff, ClobLocatorWork_v5.stat, ConnectionLocatorWork_v2.diff, ConnectionLocatorWork_v4.diff
>
>


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


[jira] Commented: (DERBY-2604) Implement Clob support for locators

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12504551 ] 

V.Narayanan commented on DERBY-2604:
------------------------------------

I found a few problems in v6 I submitted yesterday. I am working on v6
and shall revert back with a new patch and corresponding test runs in a
few hours.





> 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
>            Assignee: V.Narayanan
>             Fix For: 10.3.0.0
>
>         Attachments: ClobLocatorWork_v1.diff, ClobLocatorWork_v1.stat, ClobLocatorWork_v2.diff, ClobLocatorWork_v2.stat, ClobLocatorWork_v3.diff, ClobLocatorWork_v3.stat, ClobLocatorWork_v4.diff, ClobLocatorWork_v4.stat, ClobLocatorWork_v5.diff, ClobLocatorWork_v5.stat, ClobLocatorWork_v6.diff, ClobLocatorWork_v6.stat, ConnectionLocatorWork_v2.diff, ConnectionLocatorWork_v4.diff
>
>


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


[jira] Commented: (DERBY-2604) Implement Clob support for locators

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12494234 ] 

Knut Anders Hatlen commented on DERBY-2604:
-------------------------------------------

Hi Narayanan, I haven't looked at the entire patch, only ClobLocatorInputStream.java, but I have a couple of comments:

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.

2) The boundary checking in read(byte[],int,int) might suffer from int overflow. (off+len > b.length) should be replaced with (len > b.length - off).

3) clob and connection could be final, I think.

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


[jira] Updated: (DERBY-2604) Implement Clob support for locators

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

V.Narayanan updated DERBY-2604:
-------------------------------

    Attachment: ClobLocatorWork_v1.stat
                ClobLocatorWork_v1.diff

The attached patch, ClobLocatorWork_v1.diff, adds support for locators for Clob methods. Note that the use of locators for Clob is still not enabled. This as mentioned will be done as a seperate JIRA issue.

The changes to the various files and their purport are as following

M      java/client/org/apache/derby/client/net/NetCursor.java

Create locator based Clob object if locator is sent.

A      java/client/org/apache/derby/client/am/ClobLocatorWriter.java

Writer for locator based Clob. 

M      java/client/org/apache/derby/client/am/Clob.java

Add constructor for locator based Clob objects.

Make all Clob operations support locators. Operations are performed by calling stored procedures through the framework implemented by CallableLocatorProcedures class.

Create locator based versions of streams for locator based Clob objects 

A      java/client/org/apache/derby/client/am/ClobLocatorInputStream.java

InputStream for locator based Clob. 

A      java/client/org/apache/derby/client/am/ClobLocatorOutputStream.java

OutputStream for locator based Clob. 

A      java/client/org/apache/derby/client/am/ClobLocatorReader.java

Reader for locator based Clob.

I have run tests(junit All) on this patch and there were no failures.



> Implement Clob support for locators
> -----------------------------------
>
>                 Key: DERBY-2604
>                 URL: https://issues.apache.org/jira/browse/DERBY-2604
>             Project: Derby
>          Issue Type: Sub-task
>            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.


[jira] Updated: (DERBY-2604) Implement Clob support for locators

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

V.Narayanan updated DERBY-2604:
-------------------------------

    Attachment: ClobLocatorWork_v7.stat
                ClobLocatorWork_v7.diff

I had made a mistake in changing maxPos to final
and not changing the corresponding contructor and
also in not returning the index that had been moved
to the else block as suggested.

I have fixed these issues in this patch.

I ran BlobClob4BlobTest after these changes and found no failures.

I have started junit All.

The changes are very small. I request for this patch to be considered
for reviews/comments.

> 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
>            Assignee: V.Narayanan
>             Fix For: 10.3.0.0
>
>         Attachments: ClobLocatorWork_v1.diff, ClobLocatorWork_v1.stat, ClobLocatorWork_v2.diff, ClobLocatorWork_v2.stat, ClobLocatorWork_v3.diff, ClobLocatorWork_v3.stat, ClobLocatorWork_v4.diff, ClobLocatorWork_v4.stat, ClobLocatorWork_v5.diff, ClobLocatorWork_v5.stat, ClobLocatorWork_v6.diff, ClobLocatorWork_v6.stat, ClobLocatorWork_v7.diff, ClobLocatorWork_v7.stat, ConnectionLocatorWork_v2.diff, ConnectionLocatorWork_v4.diff
>
>


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


[jira] Commented: (DERBY-2604) Implement Clob support for locators

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12494500 ] 

V.Narayanan commented on DERBY-2604:
------------------------------------


Thank You Knut. I will submit a patch for this. Thanks to you and 
Oystein for the guidance.




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


[jira] Assigned: (DERBY-2604) Implement Clob support for locators

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

V.Narayanan reassigned DERBY-2604:
----------------------------------

    Assignee: V.Narayanan

> Implement Clob support for locators
> -----------------------------------
>
>                 Key: DERBY-2604
>                 URL: https://issues.apache.org/jira/browse/DERBY-2604
>             Project: Derby
>          Issue Type: Sub-task
>            Reporter: V.Narayanan
>         Assigned To: V.Narayanan
>


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


[jira] Commented: (DERBY-2604) Implement Clob support for locators

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12504699 ] 

V.Narayanan commented on DERBY-2604:
------------------------------------

Thanks for the commit knut!!!





> 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
>            Assignee: V.Narayanan
>             Fix For: 10.3.0.0
>
>         Attachments: ClobLocatorWork_v1.diff, ClobLocatorWork_v1.stat, ClobLocatorWork_v2.diff, ClobLocatorWork_v2.stat, ClobLocatorWork_v3.diff, ClobLocatorWork_v3.stat, ClobLocatorWork_v4.diff, ClobLocatorWork_v4.stat, ClobLocatorWork_v5.diff, ClobLocatorWork_v5.stat, ClobLocatorWork_v6.diff, ClobLocatorWork_v6.stat, ClobLocatorWork_v7.diff, ClobLocatorWork_v7.stat, ClobLocatorWork_v8.diff, ClobLocatorWork_v8.stat, ConnectionLocatorWork_v2.diff, ConnectionLocatorWork_v4.diff
>
>


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


[jira] Commented: (DERBY-2604) Implement Clob support for locators

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12494492 ] 

Knut Anders Hatlen commented on DERBY-2604:
-------------------------------------------

I am fine with your comments. DERBY-1519 is logged for the US-ASCII/ISO-8859-1 issue.

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


[jira] Commented: (DERBY-2604) Implement Clob support for locators

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12495065 ] 

Knut Anders Hatlen commented on DERBY-2604:
-------------------------------------------

Thanks for the patch, Narayanan! It looks like all my comments have been addressed, so I'm planning to commit the patch once I have run the regression tests.

> 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, ClobLocatorWork_v2.diff, ClobLocatorWork_v2.stat, ClobLocatorWork_v3.diff, ClobLocatorWork_v3.stat, ConnectionLocatorWork_v2.diff
>
>


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


[jira] Commented: (DERBY-2604) Implement Clob support for locators

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12499292 ] 

V.Narayanan commented on DERBY-2604:
------------------------------------

I ran junit All on v4 and found no failures. I request for v4 to be considered for a commit.

> 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, ClobLocatorWork_v2.diff, ClobLocatorWork_v2.stat, ClobLocatorWork_v3.diff, ClobLocatorWork_v3.stat, ClobLocatorWork_v4.diff, ClobLocatorWork_v4.stat, ConnectionLocatorWork_v2.diff, ConnectionLocatorWork_v4.diff
>
>


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


[jira] Updated: (DERBY-2604) Implement Clob support for locators

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

V.Narayanan updated DERBY-2604:
-------------------------------

    Attachment: ClobLocatorWork_v4.diff

I attached the wrong file ConnectionLocatorWork_v4.

Pls *ignore* ConnectionLocatorWork_v4.diff

Attaching the correct file ClobLocatorWork_v4.diff.

Pls consider ClobLocatorWork_v4.diff for reviews and comments.

I have not yet run junit All on this patch. I will run the tests and
revert back with the results.

> 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, ClobLocatorWork_v2.diff, ClobLocatorWork_v2.stat, ClobLocatorWork_v3.diff, ClobLocatorWork_v3.stat, ClobLocatorWork_v4.diff, ClobLocatorWork_v4.stat, ConnectionLocatorWork_v2.diff, ConnectionLocatorWork_v4.diff
>
>


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


[jira] Commented: (DERBY-2604) Implement Clob support for locators

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12499316 ] 

V.Narayanan commented on DERBY-2604:
------------------------------------

There are a few more issues I haven't addressed in v4 that need to be addressed

1)  Add buffering for InputStreams by wrapping ClobLocatorInputStream in
      a BufferedInputStream and ClobLocatorReader in a BufferedReader.

2)  I noticed that in BlobLocatorInputStream, maxPos is used to store the size
     of the Blob. This is initialized in the constructor of BlobLocatorInputStream.
     This I observed serves the following purpose.
      
     a)   If the locator associated with the Blob object becomes invalid(e.g. due to
           a transaction commit) and the getBinaryStream is called to retrieve
           an InputStream the sqlLength() call in the constructor of BlobInputStream
           would throw an SQLException saying the locator associated with this 
           Blob is invalid. 

           On the other hand if this method call were not there we would
           get a stream from the Blob and would be informed of the locator invalidation
           only during the first call to any method on this InputStream. 

           I observed this when I ran BlobClob4BlobTest after enabling locators.
           In testClobAfterCommit() clob.getAsciiStream was not failing as expected 
           because the current ClobLocatorInputStream does not call clob.sqlLength()
           in its constructor.

3)  I also think using maxPos to return a CharacterStream subset requested by
      getCharacterStream(long, long) is better than the length() method implemented
      by.

Pls accept my apologies for this last moment change. I will be submitting a new v5 patch addressing the above.
pls ignore v4. 

If anyone has reviewed v4 and find this addition inconvinient I will submit these changes as a
follow up to v4.

> 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, ClobLocatorWork_v2.diff, ClobLocatorWork_v2.stat, ClobLocatorWork_v3.diff, ClobLocatorWork_v3.stat, ClobLocatorWork_v4.diff, ClobLocatorWork_v4.stat, ConnectionLocatorWork_v2.diff, ConnectionLocatorWork_v4.diff
>
>


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


[jira] Updated: (DERBY-2604) Implement Clob support for locators

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen updated DERBY-2604:
--------------------------------------

    Derby Info:   (was: [Patch Available])

Looks good to me. Committed revision 544119.

A couple of minor nits:

The new field maxPos in ClobLocatorInputStream/Reader could be final, I think. (The same is probably true for the clob and connection field, and for the corresponding fields in the Blob streams, but those classes/fields were not touched by your patch.)

Since there are both JDBC positions (counting from 1) and stream positions (counting from 0) in the stream classes, it would be good if maxPos's javadoc said where maxPos started counting from.

In Clob.positionX(), I think that it would be clearer if the code that increments index by 1 for non-locator lobs were moved into the else block right above it. (Then we don't need to check isLocator() twice.)

Also in Clob.positionX(), I think the index variable should be changed to a long. As it is now, clobGetPositionFromLocator() returns a long which is cast to int before it is cast back to long and returned. It's better to keep it as a long all the way.

> 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
>            Assignee: V.Narayanan
>             Fix For: 10.3.0.0
>
>         Attachments: ClobLocatorWork_v1.diff, ClobLocatorWork_v1.stat, ClobLocatorWork_v2.diff, ClobLocatorWork_v2.stat, ClobLocatorWork_v3.diff, ClobLocatorWork_v3.stat, ClobLocatorWork_v4.diff, ClobLocatorWork_v4.stat, ClobLocatorWork_v5.diff, ClobLocatorWork_v5.stat, ConnectionLocatorWork_v2.diff, ConnectionLocatorWork_v4.diff
>
>


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


[jira] Commented: (DERBY-2604) Implement Clob support for locators

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12499277 ] 

V.Narayanan commented on DERBY-2604:
------------------------------------

I have two more tasks to this issue. 

1)  Making the necessary changes to  enable the use 
     of locators for Clob.  As part of this task I will have to 
     modify tests that experience changed behavior with 
     locators.

2)  Enable Locator Support for Clobs. 

I intend to raise two subtasks under Derby-208 the parent 
issue for doing this for the following reasons

a)  Ideally these should be a subtask of this issue. But I
     cannot create a subtask of a subtask.

b)  Parrallel discussion on these issues can happen without
      the comments getting mixed up in the same issue.

c)  It will help potential committers reviewing these patches
      since then the patches will not get mixed up in the plethora of 
      versions already exisiting in this issue and those which I might
      have to attach.

> 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, ClobLocatorWork_v2.diff, ClobLocatorWork_v2.stat, ClobLocatorWork_v3.diff, ClobLocatorWork_v3.stat, ClobLocatorWork_v4.diff, ClobLocatorWork_v4.stat, ConnectionLocatorWork_v2.diff, ConnectionLocatorWork_v4.diff
>
>


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


[jira] Commented: (DERBY-2604) Implement Clob support for locators

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12499516 ] 

V.Narayanan commented on DERBY-2604:
------------------------------------

I ran junit all on v5(ClobLocatorWork_v5.diff) and saw no failures. I request for ClobLocatorWork_v5.diff to be considered for a commit. (I hadn't mentioned the patch version on which I had run tests properly in the previous email.)

> 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
>            Assignee: V.Narayanan
>         Attachments: ClobLocatorWork_v1.diff, ClobLocatorWork_v1.stat, ClobLocatorWork_v2.diff, ClobLocatorWork_v2.stat, ClobLocatorWork_v3.diff, ClobLocatorWork_v3.stat, ClobLocatorWork_v4.diff, ClobLocatorWork_v4.stat, ClobLocatorWork_v5.diff, ClobLocatorWork_v5.stat, ConnectionLocatorWork_v2.diff, ConnectionLocatorWork_v4.diff
>
>


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


[jira] Commented: (DERBY-2604) Implement Clob support for locators

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12504697 ] 

Knut Anders Hatlen commented on DERBY-2604:
-------------------------------------------

Thanks Narayanan. Committed revision 547236.

> 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
>            Assignee: V.Narayanan
>             Fix For: 10.3.0.0
>
>         Attachments: ClobLocatorWork_v1.diff, ClobLocatorWork_v1.stat, ClobLocatorWork_v2.diff, ClobLocatorWork_v2.stat, ClobLocatorWork_v3.diff, ClobLocatorWork_v3.stat, ClobLocatorWork_v4.diff, ClobLocatorWork_v4.stat, ClobLocatorWork_v5.diff, ClobLocatorWork_v5.stat, ClobLocatorWork_v6.diff, ClobLocatorWork_v6.stat, ClobLocatorWork_v7.diff, ClobLocatorWork_v7.stat, ClobLocatorWork_v8.diff, ClobLocatorWork_v8.stat, ConnectionLocatorWork_v2.diff, ConnectionLocatorWork_v4.diff
>
>


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


[jira] Closed: (DERBY-2604) Implement Clob support for locators

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

V.Narayanan closed DERBY-2604.
------------------------------

    Resolution: Fixed

All patches submitted and committed!

> 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
>            Assignee: V.Narayanan
>             Fix For: 10.3.0.0
>
>         Attachments: ClobLocatorWork_v1.diff, ClobLocatorWork_v1.stat, ClobLocatorWork_v2.diff, ClobLocatorWork_v2.stat, ClobLocatorWork_v3.diff, ClobLocatorWork_v3.stat, ClobLocatorWork_v4.diff, ClobLocatorWork_v4.stat, ClobLocatorWork_v5.diff, ClobLocatorWork_v5.stat, ClobLocatorWork_v6.diff, ClobLocatorWork_v6.stat, ClobLocatorWork_v7.diff, ClobLocatorWork_v7.stat, ClobLocatorWork_v8.diff, ClobLocatorWork_v8.stat, ConnectionLocatorWork_v2.diff, ConnectionLocatorWork_v4.diff
>
>


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


[jira] Commented: (DERBY-2604) Implement Clob support for locators

Posted by "Myrna van Lunteren (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12502660 ] 

Myrna van Lunteren commented on DERBY-2604:
-------------------------------------------

Is a follow up patch still forthcoming, or is that with another issue?

> 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
>            Assignee: V.Narayanan
>             Fix For: 10.3.0.0
>
>         Attachments: ClobLocatorWork_v1.diff, ClobLocatorWork_v1.stat, ClobLocatorWork_v2.diff, ClobLocatorWork_v2.stat, ClobLocatorWork_v3.diff, ClobLocatorWork_v3.stat, ClobLocatorWork_v4.diff, ClobLocatorWork_v4.stat, ClobLocatorWork_v5.diff, ClobLocatorWork_v5.stat, ConnectionLocatorWork_v2.diff, ConnectionLocatorWork_v4.diff
>
>


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


[jira] Updated: (DERBY-2604) Implement Clob support for locators

Posted by "Mike Matrigali (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mike Matrigali updated DERBY-2604:
----------------------------------

    Component/s: Network Server

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


[jira] Commented: (DERBY-2604) Implement Clob support for locators

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12499514 ] 

V.Narayanan commented on DERBY-2604:
------------------------------------

I have run junit all on this patch. I observed no failures. I request for this patch to be considered for a commit.

> 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
>            Assignee: V.Narayanan
>         Attachments: ClobLocatorWork_v1.diff, ClobLocatorWork_v1.stat, ClobLocatorWork_v2.diff, ClobLocatorWork_v2.stat, ClobLocatorWork_v3.diff, ClobLocatorWork_v3.stat, ClobLocatorWork_v4.diff, ClobLocatorWork_v4.stat, ClobLocatorWork_v5.diff, ClobLocatorWork_v5.stat, ConnectionLocatorWork_v2.diff, ConnectionLocatorWork_v4.diff
>
>


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


[jira] Commented: (DERBY-2604) Implement Clob support for locators

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12494489 ] 

V.Narayanan commented on DERBY-2604:
------------------------------------

thanx a ton for taking a look at the patch and commenting on it Oystein 
and Knut!

1) Thank you for the suggestion on the conversion to ASCII.
    I think you are correct and I will do it the same way.

2) The behaviour on Close() is not uniform in the streams returned from Lobs
     in the server and client.

    For example in am/ClobWriter close does this

    public void close() throws java.io.IOException {
    }

    while on the embedded side impl/jdbc/ClobUtf8Writer close() is this
   
    /**
     * Closes the stream, flushing it first. Once the stream has been 
closed,
     * further write() or flush() invocations will cause an IOException 
to be
     * thrown. Closing a previously closed stream has no effect.
     */
    public void close() {
        closed = true;
    }

    I intend to leave close() as it is currently implemented in the 
locator streams
    unless there is objection to this.

3) In the writeBytes(byte b[]) method line no 66 
am/ClobOutputStream.java I found this
     conversion from byte to String
  
    String str = new String(b, "US-ASCII");

    I am not sure if both the contexts match but seems like it.
    




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


[jira] Commented: (DERBY-2604) Implement Clob support for locators

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12501205 ] 

V.Narayanan commented on DERBY-2604:
------------------------------------

Thanx a ton for this commit Knut.

I am hoping to submit a patch for DERBY-2702 before going home today.

I will produce the follow up patch for this tommorrow.

Thanx again for the reviews, comments and commit.





> 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
>            Assignee: V.Narayanan
>             Fix For: 10.3.0.0
>
>         Attachments: ClobLocatorWork_v1.diff, ClobLocatorWork_v1.stat, ClobLocatorWork_v2.diff, ClobLocatorWork_v2.stat, ClobLocatorWork_v3.diff, ClobLocatorWork_v3.stat, ClobLocatorWork_v4.diff, ClobLocatorWork_v4.stat, ClobLocatorWork_v5.diff, ClobLocatorWork_v5.stat, ConnectionLocatorWork_v2.diff, ConnectionLocatorWork_v4.diff
>
>


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


[jira] Commented: (DERBY-2604) Implement Clob support for locators

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12495472 ] 

V.Narayanan commented on DERBY-2604:
------------------------------------

Thank you for the commit knut!




> 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, ClobLocatorWork_v2.diff, ClobLocatorWork_v2.stat, ClobLocatorWork_v3.diff, ClobLocatorWork_v3.stat, ConnectionLocatorWork_v2.diff
>
>


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


[jira] Commented: (DERBY-2604) Implement Clob support for locators

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12494490 ] 

V.Narayanan commented on DERBY-2604:
------------------------------------

 >I found this the javadoc for OutputStream.write(int):
 >IOException - if an I/O error occurs. In particular,
 >an IOException may be thrown if the output stream has been closed.

I agree. But I think it is OK to not throw an exception as seen from this.
I saw Oystein's reply also which agrees with this interpretation. My 
previous
idea of retaining the current implementation in the locator streams for 
close
are also on the same lines. Pls do mention if you think this should be 
the case.




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


[jira] Updated: (DERBY-2604) Implement Clob support for locators

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

V.Narayanan updated DERBY-2604:
-------------------------------

    Attachment: ClobLocatorWork_v6.stat
                ClobLocatorWork_v6.diff

I have addressed all the follow up issues pointed out in this patch.
I request for this patch to be considered for reviews and comments. 

I shall run junit All and revert back.


> 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
>            Assignee: V.Narayanan
>             Fix For: 10.3.0.0
>
>         Attachments: ClobLocatorWork_v1.diff, ClobLocatorWork_v1.stat, ClobLocatorWork_v2.diff, ClobLocatorWork_v2.stat, ClobLocatorWork_v3.diff, ClobLocatorWork_v3.stat, ClobLocatorWork_v4.diff, ClobLocatorWork_v4.stat, ClobLocatorWork_v5.diff, ClobLocatorWork_v5.stat, ClobLocatorWork_v6.diff, ClobLocatorWork_v6.stat, ConnectionLocatorWork_v2.diff, ConnectionLocatorWork_v4.diff
>
>


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


[jira] Commented: (DERBY-2604) Implement Clob support for locators

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12504602 ] 

V.Narayanan commented on DERBY-2604:
------------------------------------

I ran junit All on this patch and found no failures. I request that if
everything is OK this patch(v7) be considered for a commit.




> 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
>            Assignee: V.Narayanan
>             Fix For: 10.3.0.0
>
>         Attachments: ClobLocatorWork_v1.diff, ClobLocatorWork_v1.stat, ClobLocatorWork_v2.diff, ClobLocatorWork_v2.stat, ClobLocatorWork_v3.diff, ClobLocatorWork_v3.stat, ClobLocatorWork_v4.diff, ClobLocatorWork_v4.stat, ClobLocatorWork_v5.diff, ClobLocatorWork_v5.stat, ClobLocatorWork_v6.diff, ClobLocatorWork_v6.stat, ClobLocatorWork_v7.diff, ClobLocatorWork_v7.stat, ConnectionLocatorWork_v2.diff, ConnectionLocatorWork_v4.diff
>
>


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


[jira] Commented: (DERBY-2604) Implement Clob support for locators

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12504623 ] 

Knut Anders Hatlen commented on DERBY-2604:
-------------------------------------------

Thanks for the follow-up patch, Narayanan!

Most of it looks good, but I think this change in Clob positionX(Clob,long) is wrong:

@@ -559,18 +559,12 @@
                 index = string_.indexOf(searchstr.getSubString(1L,
                                                     (int) searchstr.length()),
                                         (int) start - 1);
+                index++;
             }
         } catch (java.sql.SQLException e) {

index should only be increased by one if it is not equal to -1. This didn't show up in the JUnit tests because the code is only used if the client runs against a 10.2 server or earlier. By the way, perhaps this line should have a comment which said something like "increase the index by one since String positions are 0-based and Clob positions are 1-based"?

> 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
>            Assignee: V.Narayanan
>             Fix For: 10.3.0.0
>
>         Attachments: ClobLocatorWork_v1.diff, ClobLocatorWork_v1.stat, ClobLocatorWork_v2.diff, ClobLocatorWork_v2.stat, ClobLocatorWork_v3.diff, ClobLocatorWork_v3.stat, ClobLocatorWork_v4.diff, ClobLocatorWork_v4.stat, ClobLocatorWork_v5.diff, ClobLocatorWork_v5.stat, ClobLocatorWork_v6.diff, ClobLocatorWork_v6.stat, ClobLocatorWork_v7.diff, ClobLocatorWork_v7.stat, ConnectionLocatorWork_v2.diff, ConnectionLocatorWork_v4.diff
>
>


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


[jira] Updated: (DERBY-2604) Implement Clob support for locators

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

V.Narayanan updated DERBY-2604:
-------------------------------

    Attachment: ClobLocatorWork_v4.stat
                ConnectionLocatorWork_v4.diff

This patch addresses the bugs that were found during the process of enabling 
Clob support for locators.

Pls note that Clob locators are currently disabled. 

I have not yet run junit All for the patch. Since the code is diabled I do not 
expect any failures. But  I will run junit All and revert back with the results.

The following are the details of the details of the files modified and their
import apropos the context.

M      java/client/org/apache/derby/client/am/ClobLocatorWriter.java

writeCharacters(line no 162) method was using c.length as the length of the string
transmitted to the server using the clobSetString stored procedure. This should
use len instead.

M      java/client/org/apache/derby/client/am/Clob.java

The PositionX method on the client that accepts a Clob had not been converted 
to use locators. This has been done.

The getCharacterStream(long pos, long length) method should return a stream of
length characters starting from pos. Hence the length parameter that should be
passed to the constructor of the ClobLocatorReader class should have been
pos+len-1 instead of len.

M      java/client/org/apache/derby/client/am/CallableLocatorProcedures.java

The stored procedure call to CLOBGETPOSITIONFROMSTRING was sending the 
original string instead of sending it in chunks. This has been changed to send the 
chunks instead(stringToBeCompared).

> 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, ClobLocatorWork_v2.diff, ClobLocatorWork_v2.stat, ClobLocatorWork_v3.diff, ClobLocatorWork_v3.stat, ClobLocatorWork_v4.stat, ConnectionLocatorWork_v2.diff, ConnectionLocatorWork_v4.diff
>
>


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


[jira] Updated: (DERBY-2604) Implement Clob support for locators

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

V.Narayanan updated DERBY-2604:
-------------------------------

    Derby Info: [Patch Available]

> 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, ClobLocatorWork_v2.diff, ClobLocatorWork_v2.stat, ClobLocatorWork_v3.diff, ClobLocatorWork_v3.stat, ClobLocatorWork_v4.diff, ClobLocatorWork_v4.stat, ConnectionLocatorWork_v2.diff, ConnectionLocatorWork_v4.diff
>
>


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


[jira] Commented: (DERBY-2604) Implement Clob support for locators

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
    [ 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:
------------------------------------

Thanx a ton for looking at this and giving your feedback/comments. Pls find answers to your queries below. Pls do point out if I have made any mistake in any of the analysis I have done.

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

>2) The boundary checking in read(byte[],int,int) might suffer from 
>int overflow. (off+len > b.length) should be replaced with 
>(len > b.length - off).

you are correct. I will do this.

>3) clob and connection could be final, I think.

I will do this.

2) and 3) are valid for ClobReader/Writer also.

>4)I noticed that ClobLocator{Reader,Writer} check whether the object is closed, 
>  whereas ClobLocator{Input,Output}Stream don't. Is there any reason for this?

I read the API doc for java.io.Reader/Writer and saw that it was mentioned that
implementation of the close() method was mandatory here. This is not the case
for InputStream/OutputStream.

Also in the the explanation for the close() method of Reader/Writer it was
mentioned that when a read or write is called after close an IOException is
thrown. But the behaviour that needs to be exhibited for InputStream/OutputStream
methods after close was not mentioned.

>5) ClobLocatorOutputStream.writeBytes() has this line:
>    String clobStr = new String(b);
>   Should it also have specified the encoding?

Yes you are correct. It should have been US-ASCII, I will fix this.

>6) Perhaps it would be easier to make ClobLocatorInputStream a wrapper around 
>ClobLocatorReader, and ClobLocatorOutputStream a wrapper around ClobLocatorWriter?

I thought about this while working on the patch but decided against it because
if you did the wrapping as you suggested. 

The only method that would be shared  would have the functionality of a stored 
procedure call to CLOBGETSTRING to get a string from the Clob. The interconversion 
to Byte array or a Char array will still remain in the respective methods.

There was not much code sharing I could achieve by forwarding calls to the Reader/Writer
implementation and the inter conversion between String and Bytes and Chars still remained.

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


[jira] Commented: (DERBY-2604) Implement Clob support for locators

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12494244 ] 

V.Narayanan commented on DERBY-2604:
------------------------------------

Thank You for the comments Knut. I will address them in a following patch.




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


[jira] Updated: (DERBY-2604) Implement Clob support for locators

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

V.Narayanan updated DERBY-2604:
-------------------------------

    Attachment: ClobLocatorWork_v3.stat
                ClobLocatorWork_v3.diff

I discussed this patch with knut and came to the conclusion that the check (off+len<0) (in ClobLocatorWriter and ClobLocatorOutputStream) was redundant because  if off+len overflows, and off>=0 and len>=0 and c.length>=0 and c.length <= Integer.MAX_VALUE, then (len > c.length - off) is always true. (Thanks to knut for pointing this out)

I am submitting a patch with this reduntant check removed.

I haven't run any tests with the new patch(with the check removed). The patch with this check did not give any failures. So I think this is OK. Also the locator code is not enabled yet and hence I do not expect any test failures.

Pls consider v3 for reviews and comments and if everything is ok a commit too.

> 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, ClobLocatorWork_v2.diff, ClobLocatorWork_v2.stat, ClobLocatorWork_v3.diff, ClobLocatorWork_v3.stat, ConnectionLocatorWork_v2.diff
>
>


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


[jira] Updated: (DERBY-2604) Implement Clob support for locators

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

V.Narayanan updated DERBY-2604:
-------------------------------

    Attachment: ClobLocatorWork_v2.diff

Sorry attached the wrong diff. Pls *ignore* previous attachment ConnectionLocatorWork_v2.diff.

Pls consider ClobLocatorWork_v2.diff for reviews and comments. I have started the tests and 
shall report back as soon as they complete.

> 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, ClobLocatorWork_v2.diff, ClobLocatorWork_v2.stat, ConnectionLocatorWork_v2.diff
>
>


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


[jira] Commented: (DERBY-2604) Implement Clob support for locators

Posted by "Øystein Grøvlen (JIRA)" <ji...@apache.org>.
    [ 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.


[jira] Commented: (DERBY-2604) Implement Clob support for locators

Posted by "Rick Hillegas (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12493734 ] 

Rick Hillegas commented on DERBY-2604:
--------------------------------------

Thanks, Naryanan. The patch looks good to me. The tests pass cleanly. Committed ClobLocatorWork_v1.diff at subversion revision 535319.

> Implement Clob support for locators
> -----------------------------------
>
>                 Key: DERBY-2604
>                 URL: https://issues.apache.org/jira/browse/DERBY-2604
>             Project: Derby
>          Issue Type: Sub-task
>            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.


[jira] Commented: (DERBY-2604) Implement Clob support for locators

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12502663 ] 

V.Narayanan commented on DERBY-2604:
------------------------------------

Thank you for following up, I will submit a follow-up for this today, I was held up with maxPos relating to DERBY-2764, DERBY-2763

> 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
>            Assignee: V.Narayanan
>             Fix For: 10.3.0.0
>
>         Attachments: ClobLocatorWork_v1.diff, ClobLocatorWork_v1.stat, ClobLocatorWork_v2.diff, ClobLocatorWork_v2.stat, ClobLocatorWork_v3.diff, ClobLocatorWork_v3.stat, ClobLocatorWork_v4.diff, ClobLocatorWork_v4.stat, ClobLocatorWork_v5.diff, ClobLocatorWork_v5.stat, ConnectionLocatorWork_v2.diff, ConnectionLocatorWork_v4.diff
>
>


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


[jira] Updated: (DERBY-2604) Implement Clob support for locators

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

V.Narayanan updated DERBY-2604:
-------------------------------

    Attachment: ClobLocatorWork_v8.stat
                ClobLocatorWork_v8.diff

Thank you for the comments Knut. I have fixed the issue pointed out.

> 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
>            Assignee: V.Narayanan
>             Fix For: 10.3.0.0
>
>         Attachments: ClobLocatorWork_v1.diff, ClobLocatorWork_v1.stat, ClobLocatorWork_v2.diff, ClobLocatorWork_v2.stat, ClobLocatorWork_v3.diff, ClobLocatorWork_v3.stat, ClobLocatorWork_v4.diff, ClobLocatorWork_v4.stat, ClobLocatorWork_v5.diff, ClobLocatorWork_v5.stat, ClobLocatorWork_v6.diff, ClobLocatorWork_v6.stat, ClobLocatorWork_v7.diff, ClobLocatorWork_v7.stat, ClobLocatorWork_v8.diff, ClobLocatorWork_v8.stat, ConnectionLocatorWork_v2.diff, ConnectionLocatorWork_v4.diff
>
>


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


Re: [jira] Commented: (DERBY-2604) Implement Clob support for locators

Posted by Oystein Grovlen - Sun Norway <Oy...@Sun.COM>.
Knut Anders Hatlen (JIRA) wrote:

 >> But the behaviour that needs to be exhibited for
 >> InputStream/OutputStream
 >> methods after close was not mentioned.
  >
  > I found this the javadoc for OutputStream.write(int):
  > IOException - if an I/O error occurs. In particular, an IOException
  > may be thrown if the output stream has been closed.

I do not think that this means that it is required behavior.  At
least, the javadoc for java.io.ByteArrayOutputStream indicates that
not all OutputStreams behave that way:

      Closing a ByteArrayOutputStream has no effect. The methods in this
      class can be called after the stream has been closed without
      generating an IOException.

-- 
Øystein

[jira] Commented: (DERBY-2604) Implement Clob support for locators

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12494485 ] 

Knut Anders Hatlen commented on DERBY-2604:
-------------------------------------------

Thanks for answering, Narayanan!

I believe Øystein is correct about the conversion to ASCII.

> But the behaviour that needs to be exhibited for InputStream/OutputStream
> methods after close was not mentioned. 

I found this the javadoc for OutputStream.write(int):
IOException - if an I/O error occurs. In particular, an IOException may be thrown if the output stream has been closed.

>>5) ClobLocatorOutputStream.writeBytes() has this line:
>>    String clobStr = new String(b);
>>   Should it also have specified the encoding?
>
> Yes you are correct. It should have been US-ASCII, I will fix this.

Since JDBC defines ASCII as the code points from 0 up to 255, I think it should be ISO-8859-1. US-ASCII is only 7 bits, I think.

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


[jira] Updated: (DERBY-2604) Implement Clob support for locators

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

V.Narayanan updated DERBY-2604:
-------------------------------

    Attachment: ClobLocatorWork_v2.stat
                ConnectionLocatorWork_v2.diff

Thanks once again for the comments and guidance Oystein and Knut. 
Pls find a patch attached addressing the comments and suggestions.
The changes to the various files and their purport apropos the context 
are elucidated below.

M      java/client/org/apache/derby/client/am/ClobLocatorWriter.java

1) Made the Clob and Connection objects final.
2) Removed making Clob and Connection null in close() (they are final)
3) changed  (off+len > c.length) to (len > c.length - off)

M      java/client/org/apache/derby/client/am/ClobLocatorInputStream.java

1) Made the Clob and Connection objects final.
2) Removed making Clob and Connection null in close() (they are final)
3) changed  (off+len > c.length) to (len > c.length - off)
4) Added a method getBytesFromString(String str) that accepts a String and returns
    a Byte array using the algorithm(in the code snippet) pointed by oystein in
    his comments.
5) Using this method in readBytes method to convert the String to bytes.

M      java/client/org/apache/derby/client/am/ClobLocatorOutputStream.java

1) Made the Clob and Connection objects final.
2) Removed making Clob and Connection null in close() (they are final)
3) changed  (off+len > c.length) to (len > c.length - off)
4) Changed String(b) to String(b, "ISO-8859-1")


M      java/client/org/apache/derby/client/am/ClobLocatorReader.java

1) Made the Clob and Connection objects final.
2) Removed making Clob and Connection null in close() (they are final)
3) changed  (off+len > c.length) to (len > c.length - off)

> 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, ClobLocatorWork_v2.stat, ConnectionLocatorWork_v2.diff
>
>


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