[
http://issues.apache.org/jira/browse/DERBY-953?page=comments#action_12371608 ]
Daniel John Debrunner commented on DERBY-953:
---------------------------------------------
Not really sure what explanations you are looking for David, I just clarified
the javadoc comments for EmbedStatement.checkStatus and checkExecStatus based
upon a few minutes of code inspection. Modifying the javadoc firms up the
contract this method is exposing and thus the code in isClosed() is allowed to
make assumptions
based upon that contract.
The checkExecStatus method only throws execeptions in two cases, one the
statement is closed and two the statement is part of a non-active global
transaction.
In either of those two cases and the no exception case after the execution the
active field correctly represents the open state of the Statement.
One exception thrown is the NO_CURRENT_CONNECTION sql state, means either :
the Statement is open but in a suspended transaction
(isClosed needs to return false)
the Statement has been closed implicitly due to its
connection being closed and this is the first
call against the Statement that has noticed the connection
has been closed. (isClosed needs to return true)
The other is ALREADY_CLOSED, means either :
the Statement has been explictly closed (isClosed needs
to return true)
the Statement has been closed implicitly and a previous
checkExecStatus threw a NO_CURRENT_CONNECTION (isClosed needs to return true)
Thus only catching NO_CURRENT_CONNECTION would be wrong as ALREADY_CLOSED is a
valid exception that could occur
here and require isClosed() to return true. Thus we are left with needing to
catch the two exceptions that this method can throw, which seems,
to me, to be the same as catching everything.
> 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,
> DERBY-953-3a.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