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

Kathey Marsden commented on DERBY-4015:
---------------------------------------

I think the noGenKeysSpecified (Call prepareStatement(String sql,int 
autogeneratedKeys) with an insert that generates a key and pass 
Statement.NO_GENERATED_KEYS for the autogeneratedKeys value)

is the key (no pun intended) to resolving this issue.  I think DB2 is right to 
return an empty ResultSet in this case and we are wrong to return null.  The 
javadoc says:

If this Statement object did not generate any keys, an empty ResultSet  object 
is returned.

so to me,  that indicates we should have an empty RS not null for this case.

My current proposal is this:   Open a new issue:  

If NO_GENERATED_KEYS is specified, Statement.getGeneratedKeys should return an 
empty ResultSet, not null

Since we treat emptyArray and nullParam as NO_GENERATED_KEYS they would also 
change to return an empty ResultSet. So we would have the following changes.
emptyArray                empty RS
nullParam           empty RS
noGenKeysSpecified  empty RS

I'd backport both the client and embedded changes to 10.3 which is a bit risky 
but awfully messy otherwise.  This issue can then be duped to the new bug.

Finally we can open  up another issue to resolve the other cases.

Thoughts?


> Regression in Statement.getGeneratedKeys()
> ------------------------------------------
>
>                 Key: DERBY-4015
>                 URL: https://issues.apache.org/jira/browse/DERBY-4015
>             Project: Derby
>          Issue Type: Bug
>          Components: Network Client
>    Affects Versions: 10.3.3.0
>         Environment: I am currently running on Mac 10.5 with Java 5. However, 
> it has also been observed on other platforms in our automated build such as 
> SUSE Linux and Windows with Java 5.
>            Reporter: Brandon Smith
>            Assignee: Kathey Marsden
>            Priority: Critical
>         Attachments: Behavior-Matrix.jpg, derby-10.3.2.1-tests.zip, 
> derby-10.3.3.0-tests.zip, Derby4015.java, Derby4015.java, Derby4015.java, 
> Derby4015.java, Derby4015.java, Derby4015.java, updatedBehaviorMatrix.txt, 
> updatedBehaviorMatrix.txt, updatedBehaviorMatrix.txt, 
> updatedBehaviorMatrix.txt
>
>
> The application of both DERBY-2653 and DERBY-3426 in the 10.3.3.0 seems to 
> have created a regression in how the network JDBC client implementation of 
> PreparedStatement.getGeneratedKeys() behaves as compared to 10.3.2.1. Note 
> that there wasn't a change in behavior between versions for the embedded 
> implementation. However, in general there are behavior discrepancies between 
> the network and client implementations for this method.

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