[ 
http://issues.apache.org/jira/browse/DERBY-953?page=comments#action_12370762 ] 

David Van Couvering commented on DERBY-953:
-------------------------------------------

I don't like the approach of using an exception to determine if the statement 
is closed.  I see your motivation -- you want to reuse the code that sets 
active to false.  I think the better way to do this is to refactor out the code 
inside checkExecStatus() that sets the active field, thusly:

protected final boolean checkActive() throws SQLException {
  if (!getConnection().isClosed())
    return true;

  active = false;
  return false;
}

protected final void checkExecStatus() throws SQLException {
  if ( ! checkActive() ) {
    throw Util.noCurrentConnection();
  }
}

public boolean isClosed() throws SQLException {
  if ( active )
    checkActive();

  return !active;
}

> Add miscellaneous Statement methods introduced by JDBC 4
> --------------------------------------------------------
>
>          Key: DERBY-953
>          URL: http://issues.apache.org/jira/browse/DERBY-953
>      Project: Derby
>         Type: New Feature
>   Components: JDBC
>     Reporter: Rick Hillegas
>     Assignee: Kristian Waagan
>      Fix For: 10.2.0.0
>  Attachments: DERBY-953-1a.diff, DERBY-953-1a.stat, DERBY-953-2a.diff
>
> As described in the JDBC 4 spec, sections 13.1 and 3.1.
> This adds support for new Statement methods added by JDBC4 and not addressed 
> by other JIRAs: isClosed() and getResultSetHoldability().

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

Reply via email to