[
http://issues.apache.org/jira/browse/DERBY-953?page=comments#action_12370874 ]
David Van Couvering commented on DERBY-953:
-------------------------------------------
Sorry, I missed that about getConnection(). But my point still stands, we
shouldn't use exceptions for making decisions mainline execution.
We can refactor getConnection() using the same approach:
/**
* Try to get the connection. Returns null if it's not valid
*/
protected final Connection getConnectionInternal() {
java.sql.Connection appConn =
getEmbedConnection().getApplicationConnection();
if (appConn != applicationConnection) {
appCon = null;
return appConn;
}
/**
* Check the status without throwing an exception. Returns true if the statement
* is active and has a valid, open connection, false otherwise
*/
protected final boolean checkExecNoException() {
Connection conn = getConnectionInternal();
if ( conn == null || conn.isClosed() )
active = false;
return active;
}
protected final void checkExecStatus() throws SQLException {
checkStatus();
if ( ! checkExecStatusNoException() )
throw Util.noCurrentConnection()
}
public final java.sql.Connection getConnection() throws SQLException {
checkStatus();
java.sql.Connection appConn = getConnectionInternal();
if ( appConn == null )
throw Util.noCurrentConnection();
}
public final boolean isClosed() throws SQLException {
return ( ! active || checkExecStatusNoException() );
}
> 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