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

Rick Hillegas updated DERBY-4869:
---------------------------------

    Attachment: derby-4869-15-aa-autoGenKeys.diff

Attaching derby-4869-15-aa-autoGenKeys.diff. This patch fixes the handling of 
the autogenerated keys ResultSet for auto-completion of network Statements. I 
will run regression tests.

One of the dependent ResultSets which a Statement can return is the ResultSet 
which describes the identity values generated while processing the statement. 
If the application has requested these values, then the Statement should not be 
auto-closed until the application has had a chance to inspect them. But when 
the ResultSet of generated values is closed, then the Statement should be 
cleaned up if it has requested closeOnCompletion().

For network Statements, a separate dependent PreparedStatement is generated to 
help return these keys. I have some reservations about this approach. I think 
that the returned ResultSet of identity values will not have the correct 
Statement associated with it. I believe that the Statement returned by 
ResultSet.getStatement() should be the original, outer Statement. However, it 
looks like the Statement associated with this ResultSet is the special internal 
Statement cooked up to retrieve the identity values.

I am not going to fix that oddity in this patch. But we may want to clean it up 
later.

One consequence of this oddity is that closing the ResultSet of generated keys 
did not trigger the closing of the outer, original Statement. The fix was to 
make the network ResultSet track its attachment to the outer Statement. This 
makes the cleanup logic for the network ResultSet look more like the cleanup 
logic for the embedded ResultSet, which also tracks an outer statement.


Touches the following files:

--------------

M      java/client/org/apache/derby/client/am/Statement.java
M      java/client/org/apache/derby/client/am/ResultSet.java

Changes to make the ResultSet of generated keys track its attachment
to the original, outer Statement.

--------------

M      
java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/StatementJdbc20Test.java

Regression test to verify that closing the ResultSet of generated keys triggers 
Statement closure when closeOnCompletion() has been requested.


> Implement JDBC 4.1, the api increment introduced by Java 7
> ----------------------------------------------------------
>
>                 Key: DERBY-4869
>                 URL: https://issues.apache.org/jira/browse/DERBY-4869
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC
>            Reporter: Rick Hillegas
>         Attachments: derby-4869-01-ac-rs-getObject.diff, 
> derby-4869-01-ad-rs-getObject.diff, derby-4869-02-aa-cs-ps-addBatch.diff, 
> derby-4869-02-ab-cs-ps-addBatch.diff, 
> derby-4869-03-aa-rs-getObject-errorCleanup.diff, 
> derby-4869-04-aa-rs-getObject-simplification.diff, 
> derby-4869-05-aa-rs-getObject-exception.diff, 
> derby-4869-06-aa-cs-getObject.diff, derby-4869-06-ab-cs-getObject.diff, 
> derby-4869-07-aa-timedisplacement.diff, derby-4869-08-ac-nullHandling.diff, 
> derby-4869-09-ac-abort.diff, derby-4869-10-aa-abortSecurityTest.diff, 
> derby-4869-11-aa-abortHidePrivates.diff, 
> derby-4869-12-aa-xaAndPooledAborts.diff, 
> derby-4869-13-aa-xaAndPooledAbortsSecurityManager.diff, 
> derby-4869-14-ac-closeOnCompletion.diff, derby-4869-15-aa-autoGenKeys.diff, 
> derby-4869-exp-01-aa-noTryCatch.diff, disable-tests.diff, 
> JDBC_4.1_Changes.html, timezone.diff
>
>
> This is a master issue logged to track our work implementing JDBC 4.1, the 
> changes to the java.sql and javax.sql packages introduced by Java 7.

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