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 "Daniel John Debrunner (JIRA)" <de...@db.apache.org> on 2006/03/12 21:34:53 UTC

[jira] Created: (DERBY-1101) ResultSet.getHoldabilty will return incorrect value when the Statement changes it's holdability

ResultSet.getHoldabilty will return incorrect value when the Statement changes it's holdability
-----------------------------------------------------------------------------------------------

         Key: DERBY-1101
         URL: http://issues.apache.org/jira/browse/DERBY-1101
     Project: Derby
        Type: Bug
  Components: JDBC  
    Versions: 10.2.0.0    
    Reporter: Daniel John Debrunner


EmbedResultSet40.getHoldability returns the holdability of the Statement  that created the ResultSet, but I think this can be changed by the application after the ResultSet has been created.

I think this method should be obtaining the holdability of the ResultSet using the Activation.getResultSetHoldability() method.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Closed: (DERBY-1101) ResultSet.getHoldabilty will return incorrect value when the ResultSet is obtained from a procedure call

Posted by "Daniel John Debrunner (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-1101?page=all ]
     
Daniel John Debrunner closed DERBY-1101:
----------------------------------------


Closed - Actually I only realised once I was adding the contribution line in the commit message that this was a patch provided by a committer. For some reason I thought it was someone else. Since I'd got so far I thought I might as well continue. :-)

> ResultSet.getHoldabilty will return incorrect value when the ResultSet is obtained from a procedure call
> --------------------------------------------------------------------------------------------------------
>
>          Key: DERBY-1101
>          URL: http://issues.apache.org/jira/browse/DERBY-1101
>      Project: Derby
>         Type: Bug

>   Components: JDBC
>     Versions: 10.2.0.0
>     Reporter: Daniel John Debrunner
>     Assignee: Knut Anders Hatlen
>     Priority: Minor
>      Fix For: 10.2.0.0
>  Attachments: derby-1101-testcase-v1.diff, derby-1101-v1.diff, derby-1101-v1.stat, testderby1101.java
>
> EmbedResultSet40.getHoldability returns the holdability of the statement returned by ResultSet.getStatement().
> When a ResultSet is created by a procedure call, its holdability may not match the holdability of the Statement  that called the procedure, which is probably what ResultSet.getStatement() should return.
> This may not be exposed as a bug yet, but I think this method should be directly obtaining the holdability of the ResultSet using the Activation.getResultSetHoldability() method, rather than through a Statement. Seems a safer approach.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-1101) ResultSet.getHoldabilty will return incorrect value when the ResultSet is obtained from a procedure call

Posted by "Daniel John Debrunner (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-1101?page=all ]

Daniel John Debrunner updated DERBY-1101:
-----------------------------------------

        Summary: ResultSet.getHoldabilty will return incorrect value when the ResultSet is obtained from a procedure call  (was: ResultSet.getHoldabilty will return incorrect value when the Statement changes it's holdability)
    Description: 
EmbedResultSet40.getHoldability returns the holdability of the statement returned by ResultSet.getStatement().
When a ResultSet is created by a procedure call, its holdability may not match the holdability of the Statement  that called the procedure, which is probably what ResultSet.getStatement() should return.

This may not be exposed as a bug yet, but I think this method should be directly obtaining the holdability of the ResultSet using the Activation.getResultSetHoldability() method, rather than through a Statement. Seems a safer approach.

  was:
EmbedResultSet40.getHoldability returns the holdability of the Statement  that created the ResultSet, but I think this can be changed by the application after the ResultSet has been created.

I think this method should be obtaining the holdability of the ResultSet using the Activation.getResultSetHoldability() method.

       Priority: Minor  (was: Major)

Statement's can't change their holdability, but I think there is a problem or potential problem here.

> ResultSet.getHoldabilty will return incorrect value when the ResultSet is obtained from a procedure call
> --------------------------------------------------------------------------------------------------------
>
>          Key: DERBY-1101
>          URL: http://issues.apache.org/jira/browse/DERBY-1101
>      Project: Derby
>         Type: Bug
>   Components: JDBC
>     Versions: 10.2.0.0
>     Reporter: Daniel John Debrunner
>     Priority: Minor

>
> EmbedResultSet40.getHoldability returns the holdability of the statement returned by ResultSet.getStatement().
> When a ResultSet is created by a procedure call, its holdability may not match the holdability of the Statement  that called the procedure, which is probably what ResultSet.getStatement() should return.
> This may not be exposed as a bug yet, but I think this method should be directly obtaining the holdability of the ResultSet using the Activation.getResultSetHoldability() method, rather than through a Statement. Seems a safer approach.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-1101) ResultSet.getHoldabilty will return incorrect value when the ResultSet is obtained from a procedure call

Posted by "Knut Anders Hatlen (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-1101?page=all ]

Knut Anders Hatlen updated DERBY-1101:
--------------------------------------

    Attachment: derby-1101-v1.diff
                derby-1101-v1.stat

Patch derby-1101-v1.diff modifies EmbedResultSet.getHoldability() so that it uses getActivation() instead of getStatement(). Please let me know if you have any comments. Thanks.

> ResultSet.getHoldabilty will return incorrect value when the ResultSet is obtained from a procedure call
> --------------------------------------------------------------------------------------------------------
>
>          Key: DERBY-1101
>          URL: http://issues.apache.org/jira/browse/DERBY-1101
>      Project: Derby
>         Type: Bug
>   Components: JDBC
>     Versions: 10.2.0.0
>     Reporter: Daniel John Debrunner
>     Assignee: Knut Anders Hatlen
>     Priority: Minor
>  Attachments: derby-1101-testcase-v1.diff, derby-1101-v1.diff, derby-1101-v1.stat, testderby1101.java
>
> EmbedResultSet40.getHoldability returns the holdability of the statement returned by ResultSet.getStatement().
> When a ResultSet is created by a procedure call, its holdability may not match the holdability of the Statement  that called the procedure, which is probably what ResultSet.getStatement() should return.
> This may not be exposed as a bug yet, but I think this method should be directly obtaining the holdability of the ResultSet using the Activation.getResultSetHoldability() method, rather than through a Statement. Seems a safer approach.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-1101) ResultSet.getHoldabilty will return incorrect value when the ResultSet is obtained from a procedure call

Posted by "Daniel John Debrunner (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-1101?page=comments#action_12373440 ] 

Daniel John Debrunner commented on DERBY-1101:
----------------------------------------------

Just to add that section 16.1.3.1 of JDBC 4.0 (proposed final draft) states:

"In the case of a SQL CALL statement, the holdability of any returned ResultSets are determined
by the stored procedure, independent of the holdability level specified to the SQL CALL statement."


> ResultSet.getHoldabilty will return incorrect value when the ResultSet is obtained from a procedure call
> --------------------------------------------------------------------------------------------------------
>
>          Key: DERBY-1101
>          URL: http://issues.apache.org/jira/browse/DERBY-1101
>      Project: Derby
>         Type: Bug

>   Components: JDBC
>     Versions: 10.2.0.0
>     Reporter: Daniel John Debrunner
>     Assignee: Knut Anders Hatlen
>     Priority: Minor
>  Attachments: derby-1101-testcase-v1.diff, derby-1101-v1.diff, derby-1101-v1.stat, testderby1101.java
>
> EmbedResultSet40.getHoldability returns the holdability of the statement returned by ResultSet.getStatement().
> When a ResultSet is created by a procedure call, its holdability may not match the holdability of the Statement  that called the procedure, which is probably what ResultSet.getStatement() should return.
> This may not be exposed as a bug yet, but I think this method should be directly obtaining the holdability of the ResultSet using the Activation.getResultSetHoldability() method, rather than through a Statement. Seems a safer approach.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-1101) ResultSet.getHoldabilty will return incorrect value when the ResultSet is obtained from a procedure call

Posted by "Daniel John Debrunner (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-1101?page=comments#action_12370189 ] 

Daniel John Debrunner commented on DERBY-1101:
----------------------------------------------

Thanks for following up on this Knut, you said:

> Since the ResultSet object was produced by a Statement internally in
> the stored procedure, and not by the Statement which called the
> procedure, I believe the current implementation of
> EmbedResultSet.getStatement() is correct. 

I'm not sure, for four reasons:

   1) It's impossible to match this behaviour in client mode.

   2) Logically the statement that created the JDBC ResultSet is the one that executed
    the CALL statement. I think the model defined by the SQL standard is that the
    JDBC ResultSet created within the procedure is turned into a SQL result set
    by the database engine and then the client JDBC creates a JDBC ResultSet from 
     the SQL result set. It just so happens that Derby can omit the conversion into
     an internal ResultSet.

   3) Once Derby supports SQL procedures, and a JDBC ResultSet is returned
    then the only Statement that makes sense is the one that invoked the CALL procedure.

    4) JDBC 4.0 - Why was the method ResultSet.getHoldability added? It can only be because
     it can return a different value to rs.getStatement().getResultSetHoldability().
  

> ResultSet.getHoldabilty will return incorrect value when the ResultSet is obtained from a procedure call
> --------------------------------------------------------------------------------------------------------
>
>          Key: DERBY-1101
>          URL: http://issues.apache.org/jira/browse/DERBY-1101
>      Project: Derby
>         Type: Bug
>   Components: JDBC
>     Versions: 10.2.0.0
>     Reporter: Daniel John Debrunner
>     Priority: Minor
>  Attachments: testderby1101.java
>
> EmbedResultSet40.getHoldability returns the holdability of the statement returned by ResultSet.getStatement().
> When a ResultSet is created by a procedure call, its holdability may not match the holdability of the Statement  that called the procedure, which is probably what ResultSet.getStatement() should return.
> This may not be exposed as a bug yet, but I think this method should be directly obtaining the holdability of the ResultSet using the Activation.getResultSetHoldability() method, rather than through a Statement. Seems a safer approach.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-1101) ResultSet.getHoldabilty will return incorrect value when the ResultSet is obtained from a procedure call

Posted by "Knut Anders Hatlen (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-1101?page=comments#action_12370267 ] 

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

> Daniel John Debrunner commented on DERBY-1101:
> ----------------------------------------------
>
> Not sure why a field is needed in EmbedResultSet, when the
> activation already maintains the state, it seems a bug to me that
> TemporaryRowHolderResultSet is not honouring its contract.

No need to have a field. (But having code in the constructor really
helped exposing errors in derbyall, since the constructor is run far
more frequently than getHoldability().)

It seems like all places a new TemporaryRowHolderImpl is created, an
Activation is readily available. Would it make sense to simply pass
that activation down to the TemporaryRowHolderImpl object and further
down to the TemporaryRowHolderResultSet?

> ResultSet.getHoldabilty will return incorrect value when the ResultSet is obtained from a procedure call
> --------------------------------------------------------------------------------------------------------
>
>          Key: DERBY-1101
>          URL: http://issues.apache.org/jira/browse/DERBY-1101
>      Project: Derby
>         Type: Bug
>   Components: JDBC
>     Versions: 10.2.0.0
>     Reporter: Daniel John Debrunner
>     Priority: Minor
>  Attachments: testderby1101.java
>
> EmbedResultSet40.getHoldability returns the holdability of the statement returned by ResultSet.getStatement().
> When a ResultSet is created by a procedure call, its holdability may not match the holdability of the Statement  that called the procedure, which is probably what ResultSet.getStatement() should return.
> This may not be exposed as a bug yet, but I think this method should be directly obtaining the holdability of the ResultSet using the Activation.getResultSetHoldability() method, rather than through a Statement. Seems a safer approach.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Assigned: (DERBY-1101) ResultSet.getHoldabilty will return incorrect value when the ResultSet is obtained from a procedure call

Posted by "Knut Anders Hatlen (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-1101?page=all ]

Knut Anders Hatlen reassigned DERBY-1101:
-----------------------------------------

    Assign To: Knut Anders Hatlen

> ResultSet.getHoldabilty will return incorrect value when the ResultSet is obtained from a procedure call
> --------------------------------------------------------------------------------------------------------
>
>          Key: DERBY-1101
>          URL: http://issues.apache.org/jira/browse/DERBY-1101
>      Project: Derby
>         Type: Bug
>   Components: JDBC
>     Versions: 10.2.0.0
>     Reporter: Daniel John Debrunner
>     Assignee: Knut Anders Hatlen
>     Priority: Minor
>  Attachments: testderby1101.java
>
> EmbedResultSet40.getHoldability returns the holdability of the statement returned by ResultSet.getStatement().
> When a ResultSet is created by a procedure call, its holdability may not match the holdability of the Statement  that called the procedure, which is probably what ResultSet.getStatement() should return.
> This may not be exposed as a bug yet, but I think this method should be directly obtaining the holdability of the ResultSet using the Activation.getResultSetHoldability() method, rather than through a Statement. Seems a safer approach.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-1101) ResultSet.getHoldabilty will return incorrect value when the ResultSet is obtained from a procedure call

Posted by "Daniel John Debrunner (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-1101?page=comments#action_12370247 ] 

Daniel John Debrunner commented on DERBY-1101:
----------------------------------------------

This code

 if (theResults instanceof TemporaryRowHolderResultSet || 

is pushing knowledge of the underlying implementation layers up into the JDBC layer,
ideally JDBC layer should just be dealing with the interfaces specified by the language layer.

I have a long term idea for improving performance by removing most/all runtime statistics code from
any language ResultSet implementation, and instead having it in a single delegation/wrapper
language ResultSet. Thus when runtime statistics is enabled each real implementation of a language
ResultSet would be wrapped in one of these runtime statistics  that would maintain costs, timing etc.
Currently this is not an easy change because there is code that performs specific instanceof checks
on ResultSet references in various places, which is really a breakdown of modularity.

I'd be more interested to know why TemporaryRowHolderResultSet is breaking the contract of getActivation.

Not sure why a field is needed in EmbedResultSet, when the activation already maintains the state, it seems a
bug to me that TemporaryRowHolderResultSet  is not honouring its contract.

> ResultSet.getHoldabilty will return incorrect value when the ResultSet is obtained from a procedure call
> --------------------------------------------------------------------------------------------------------
>
>          Key: DERBY-1101
>          URL: http://issues.apache.org/jira/browse/DERBY-1101
>      Project: Derby
>         Type: Bug
>   Components: JDBC
>     Versions: 10.2.0.0
>     Reporter: Daniel John Debrunner
>     Priority: Minor
>  Attachments: testderby1101.java
>
> EmbedResultSet40.getHoldability returns the holdability of the statement returned by ResultSet.getStatement().
> When a ResultSet is created by a procedure call, its holdability may not match the holdability of the Statement  that called the procedure, which is probably what ResultSet.getStatement() should return.
> This may not be exposed as a bug yet, but I think this method should be directly obtaining the holdability of the ResultSet using the Activation.getResultSetHoldability() method, rather than through a Statement. Seems a safer approach.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-1101) ResultSet.getHoldabilty will return incorrect value when the ResultSet is obtained from a procedure call

Posted by "Knut Anders Hatlen (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-1101?page=all ]

Knut Anders Hatlen updated DERBY-1101:
--------------------------------------

    Attachment: derby-1101-testcase-v1.diff

I have attached a patch (derby-1101-testcase-v1.diff) which adds a regression test for this issue to the jdbc40 test suite. The test doesn't fail, since the bug isn't exposed until DERBY-1111 is fixed. Test case is committed in revision 388144.

> ResultSet.getHoldabilty will return incorrect value when the ResultSet is obtained from a procedure call
> --------------------------------------------------------------------------------------------------------
>
>          Key: DERBY-1101
>          URL: http://issues.apache.org/jira/browse/DERBY-1101
>      Project: Derby
>         Type: Bug
>   Components: JDBC
>     Versions: 10.2.0.0
>     Reporter: Daniel John Debrunner
>     Assignee: Knut Anders Hatlen
>     Priority: Minor
>  Attachments: derby-1101-testcase-v1.diff, testderby1101.java
>
> EmbedResultSet40.getHoldability returns the holdability of the statement returned by ResultSet.getStatement().
> When a ResultSet is created by a procedure call, its holdability may not match the holdability of the Statement  that called the procedure, which is probably what ResultSet.getStatement() should return.
> This may not be exposed as a bug yet, but I think this method should be directly obtaining the holdability of the ResultSet using the Activation.getResultSetHoldability() method, rather than through a Statement. Seems a safer approach.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-1101) ResultSet.getHoldabilty will return incorrect value when the ResultSet is obtained from a procedure call

Posted by "Knut Anders Hatlen (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-1101?page=all ]

Knut Anders Hatlen updated DERBY-1101:
--------------------------------------

    Attachment: testderby1101.java

Attaching a small program that tests what
EmbedResultSet40.getHoldability() returns when the result set is
returned from a stored procedure.

All combinations of the CallableStatement being holdable/non-holdable
and the statement inside the stored procedure being holdable or
non-holdable are tested. The program also tests whether it is possible
to do next() after commit().

Output from the test program:

Testing holdability - 
  Statement: HOLD_CURSORS_OVER_COMMIT
  Procedure: HOLD_CURSORS_OVER_COMMIT
Internally in stored procedure:
  ResultSet.getHoldability(): HOLD_CURSORS_OVER_COMMIT
  ResultSet is in fact holdable
Externally:
  ResultSet.getHoldability(): HOLD_CURSORS_OVER_COMMIT
  ResultSet is in fact holdable

Testing holdability - 
  Statement: HOLD_CURSORS_OVER_COMMIT
  Procedure: CLOSE_CURSORS_AT_COMMIT
Internally in stored procedure:
  ResultSet.getHoldability(): CLOSE_CURSORS_AT_COMMIT
  ResultSet is in fact not holdable
Externally:
  ResultSet.getHoldability(): CLOSE_CURSORS_AT_COMMIT
  ResultSet is in fact not holdable

Testing holdability - 
  Statement: CLOSE_CURSORS_AT_COMMIT
  Procedure: HOLD_CURSORS_OVER_COMMIT
Internally in stored procedure:
  ResultSet.getHoldability(): HOLD_CURSORS_OVER_COMMIT
  ResultSet is in fact holdable
Externally:
  ResultSet.getHoldability(): HOLD_CURSORS_OVER_COMMIT
  ResultSet is in fact holdable

Testing holdability - 
  Statement: CLOSE_CURSORS_AT_COMMIT
  Procedure: CLOSE_CURSORS_AT_COMMIT
Internally in stored procedure:
  ResultSet.getHoldability(): CLOSE_CURSORS_AT_COMMIT
  ResultSet is in fact not holdable
Externally:
  ResultSet.getHoldability(): CLOSE_CURSORS_AT_COMMIT
  ResultSet is in fact not holdable

For all these cases, the observed holdability is the same as the
holdability returned by getHoldability(). Hence, I don't think the
current implementation of getHoldability() returns wrong results when
using stored procedures.

> ResultSet.getHoldabilty will return incorrect value when the ResultSet is obtained from a procedure call
> --------------------------------------------------------------------------------------------------------
>
>          Key: DERBY-1101
>          URL: http://issues.apache.org/jira/browse/DERBY-1101
>      Project: Derby
>         Type: Bug
>   Components: JDBC
>     Versions: 10.2.0.0
>     Reporter: Daniel John Debrunner
>     Priority: Minor
>  Attachments: testderby1101.java
>
> EmbedResultSet40.getHoldability returns the holdability of the statement returned by ResultSet.getStatement().
> When a ResultSet is created by a procedure call, its holdability may not match the holdability of the Statement  that called the procedure, which is probably what ResultSet.getStatement() should return.
> This may not be exposed as a bug yet, but I think this method should be directly obtaining the holdability of the ResultSet using the Activation.getResultSetHoldability() method, rather than through a Statement. Seems a safer approach.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-1101) ResultSet.getHoldabilty will return incorrect value when the ResultSet is obtained from a procedure call

Posted by "Daniel John Debrunner (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-1101?page=comments#action_12373445 ] 

Daniel John Debrunner commented on DERBY-1101:
----------------------------------------------

Patch derby-1101-v1.diff  committed (had to merge EmbedResultSet.java by hand)

> ResultSet.getHoldabilty will return incorrect value when the ResultSet is obtained from a procedure call
> --------------------------------------------------------------------------------------------------------
>
>          Key: DERBY-1101
>          URL: http://issues.apache.org/jira/browse/DERBY-1101
>      Project: Derby
>         Type: Bug

>   Components: JDBC
>     Versions: 10.2.0.0
>     Reporter: Daniel John Debrunner
>     Assignee: Knut Anders Hatlen
>     Priority: Minor
>  Attachments: derby-1101-testcase-v1.diff, derby-1101-v1.diff, derby-1101-v1.stat, testderby1101.java
>
> EmbedResultSet40.getHoldability returns the holdability of the statement returned by ResultSet.getStatement().
> When a ResultSet is created by a procedure call, its holdability may not match the holdability of the Statement  that called the procedure, which is probably what ResultSet.getStatement() should return.
> This may not be exposed as a bug yet, but I think this method should be directly obtaining the holdability of the ResultSet using the Activation.getResultSetHoldability() method, rather than through a Statement. Seems a safer approach.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (DERBY-1101) ResultSet.getHoldabilty will return incorrect value when the ResultSet is obtained from a procedure call

Posted by "Knut Anders Hatlen (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-1101?page=all ]
     
Knut Anders Hatlen resolved DERBY-1101:
---------------------------------------

    Fix Version: 10.2.0.0
     Resolution: Fixed

Thanks for committing the patch, Dan! I had forgotten that it was there myself. Please close the issue if you think it is resolved.

> ResultSet.getHoldabilty will return incorrect value when the ResultSet is obtained from a procedure call
> --------------------------------------------------------------------------------------------------------
>
>          Key: DERBY-1101
>          URL: http://issues.apache.org/jira/browse/DERBY-1101
>      Project: Derby
>         Type: Bug

>   Components: JDBC
>     Versions: 10.2.0.0
>     Reporter: Daniel John Debrunner
>     Assignee: Knut Anders Hatlen
>     Priority: Minor
>      Fix For: 10.2.0.0
>  Attachments: derby-1101-testcase-v1.diff, derby-1101-v1.diff, derby-1101-v1.stat, testderby1101.java
>
> EmbedResultSet40.getHoldability returns the holdability of the statement returned by ResultSet.getStatement().
> When a ResultSet is created by a procedure call, its holdability may not match the holdability of the Statement  that called the procedure, which is probably what ResultSet.getStatement() should return.
> This may not be exposed as a bug yet, but I think this method should be directly obtaining the holdability of the ResultSet using the Activation.getResultSetHoldability() method, rather than through a Statement. Seems a safer approach.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-1101) ResultSet.getHoldabilty will return incorrect value when the ResultSet is obtained from a procedure call

Posted by "Knut Anders Hatlen (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-1101?page=comments#action_12370196 ] 

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

OK, I see your point. I'm not able to tell whether or not you are
right, though...

One way to implement getHoldability() without being dependent on
getStatement() is to add a holdability variable to EmbedResultSet and
put something like this in the constructor:

    if (theResults instanceof TemporaryRowHolderResultSet ||
        !theResults.getActivation().getResultSetHoldability()) {
        holdability = JDBC30Translation.CLOSE_CURSORS_AT_COMMIT;
    } else {
        holdability = JDBC30Translation.HOLD_CURSORS_OVER_COMMIT;
    }

Do you think this is a better approach?

> ResultSet.getHoldabilty will return incorrect value when the ResultSet is obtained from a procedure call
> --------------------------------------------------------------------------------------------------------
>
>          Key: DERBY-1101
>          URL: http://issues.apache.org/jira/browse/DERBY-1101
>      Project: Derby
>         Type: Bug
>   Components: JDBC
>     Versions: 10.2.0.0
>     Reporter: Daniel John Debrunner
>     Priority: Minor
>  Attachments: testderby1101.java
>
> EmbedResultSet40.getHoldability returns the holdability of the statement returned by ResultSet.getStatement().
> When a ResultSet is created by a procedure call, its holdability may not match the holdability of the Statement  that called the procedure, which is probably what ResultSet.getStatement() should return.
> This may not be exposed as a bug yet, but I think this method should be directly obtaining the holdability of the ResultSet using the Activation.getResultSetHoldability() method, rather than through a Statement. Seems a safer approach.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-1101) ResultSet.getHoldabilty will return incorrect value when the ResultSet is obtained from a procedure call

Posted by "Knut Anders Hatlen (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-1101?page=comments#action_12370153 ] 

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

Dan Debrunner wrote:

> EmbedResultSet40.getHoldability returns the holdability of the
> statement returned by ResultSet.getStatement().  When a ResultSet is
> created by a procedure call, its holdability may not match the
> holdability of the Statement that called the procedure, which is
> probably what ResultSet.getStatement() should return.

Are you saying that there is a problem with
EmbedResultSet.getStatement()? It doesn't return what you say it
"probably should return".

For instance, if you have 

  stmt.execute("call mystoredprocedure(1,2,3)");
  ResultSet rs = stmt.getResultSet();

then

  stmt != rs.getStatement()

The javadoc for ResultSet.getStatement() says:

  Retrieves the Statement object that produced this ResultSet
  object. If the result set was generated some other way, such as by a
  DatabaseMetaData method, this method may return null.

Since the ResultSet object was produced by a Statement internally in
the stored procedure, and not by the Statement which called the
procedure, I believe the current implementation of
EmbedResultSet.getStatement() is correct.

> This may not be exposed as a bug yet, but I think this method should
> be directly obtaining the holdability of the ResultSet using the
> Activation.getResultSetHoldability() method, rather than through a
> Statement. Seems a safer approach.

Actually, at one point I tried to use Activation to get the result set
holdability, but since TemporaryRowHolderResultSet.getActivation() has
a THROWASSERT to make sure it is not called, I used getStatement()
instead.

> ResultSet.getHoldabilty will return incorrect value when the ResultSet is obtained from a procedure call
> --------------------------------------------------------------------------------------------------------
>
>          Key: DERBY-1101
>          URL: http://issues.apache.org/jira/browse/DERBY-1101
>      Project: Derby
>         Type: Bug
>   Components: JDBC
>     Versions: 10.2.0.0
>     Reporter: Daniel John Debrunner
>     Priority: Minor

>
> EmbedResultSet40.getHoldability returns the holdability of the statement returned by ResultSet.getStatement().
> When a ResultSet is created by a procedure call, its holdability may not match the holdability of the Statement  that called the procedure, which is probably what ResultSet.getStatement() should return.
> This may not be exposed as a bug yet, but I think this method should be directly obtaining the holdability of the ResultSet using the Activation.getResultSetHoldability() method, rather than through a Statement. Seems a safer approach.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira