[ 
https://issues.apache.org/jira/browse/DERBY-3574?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12586704#action_12586704
 ] 

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

I think that solution would work, but the callback methods in Lob are not 
currently used (Lob.listenToUnitOfWork() is never called) so they would have to 
be wired in. I'm not sure we should call free() from the callback methods, 
since we don't need to call the stored procedures on commit/rollback. Perhaps 
setting isValid to false is enough.

Like Kathey, I would prefer not storing the LOBs in a list just to invalidate 
them on transaction boundaries. What about this alternative:

 - In the connection object, keep a counter which is incremented each time a 
transaction is committed or aborted.
 - When a Lob object is created, store the current value of the transaction 
counter in the Lob object.
 - Change checkValidity() so that it checks that the current transaction is the 
same as the one that created it, something similar to:

    private void checkValidity() throws SQLException {
        if (!isValid || tx != agent_.connection_.txCounter)
            throw new SqlException(....);
    }

> With client, attempting to get the lob length after commit  or connection 
> close if there  was a call to length() before commit does not throw an 
> exception
> ----------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3574
>                 URL: https://issues.apache.org/jira/browse/DERBY-3574
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC, Network Client, Newcomer
>    Affects Versions: 10.5.0.0
>            Reporter: Kathey Marsden
>            Assignee: Tiago R. Espinha
>            Priority: Trivial
>         Attachments: derby-3574.patch, TestLobLength.java
>
>
> Attempting to get call Blob/Clob.length() after commit or connection close 
> does not fail if there was a previous call to length().  If no previous call 
> was made an exception is thrown as expected.
> See attached program TestLobLength for repro with commit.  If you comment out 
> the two lines to get the length before the commit we get the expected 
> exception.

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