@Override public boolean isClosed() { try { return super.isClosed(); } catch ( SQLException e ) { // Currently can't happen, since AvaticaStatement.isClosed() never throws // SQLException. throw new DrillRuntimeException( "Unexpected exception from " + getClass().getSuperclass() + ".isClosed(): " + e, e ); } }
/** * Throws AlreadyClosedSqlException if the associated ResultSet is closed. * * @throws AlreadyClosedSqlException if ResultSet is closed * @throws SQLException if error in checking ResultSet's status */ private void checkOpen() throws AlreadyClosedSqlException, SQLException { // Statement.isClosed() call is to avoid exception from getResultSet(). if (statement.isClosed() || (statement.getResultSet() != null // result set doesn't exist for prepared statement cases && statement.getResultSet().isClosed())) { throw new AlreadyClosedSqlException( "ResultSetMetaData's ResultSet is already closed." ); } }
@Override public boolean isClosed() throws SQLException { return super.isClosed(); }
protected void checkOpen() throws SQLException { if (isClosed()) { throw AvaticaConnection.HELPER.createException("Statement closed"); } }
protected void checkOpen() throws SQLException { if (isClosed()) { throw AvaticaConnection.HELPER.createException("Statement closed"); } }
@Override public boolean isClosed() { try { return super.isClosed(); } catch ( SQLException e ) { // Currently can't happen, since AvaticaStatement.isClosed() never throws // SQLException. throw new DrillRuntimeException( "Unexpected exception from " + getClass().getSuperclass() + ".isClosed(): " + e, e ); } }
/** * Throws AlreadyClosedSqlException if the associated ResultSet is closed. * * @throws AlreadyClosedSqlException if ResultSet is closed * @throws SQLException if error in checking ResultSet's status */ private void throwIfClosed() throws AlreadyClosedSqlException, SQLException { // Statement.isClosed() call is to avoid exception from getResultSet(). if (statement.isClosed() || (statement.getResultSet() != null // result set doesn't exist for prepared statement cases && statement.getResultSet().isClosed())) { throw new AlreadyClosedSqlException( "ResultSetMetaData's ResultSet is already closed." ); } }
/** * Throws AlreadyClosedSqlException if the associated ResultSet is closed. * * @throws AlreadyClosedSqlException if ResultSet is closed * @throws SQLException if error in checking ResultSet's status */ private void checkOpen() throws AlreadyClosedSqlException, SQLException { // Statement.isClosed() call is to avoid exception from getResultSet(). if (statement.isClosed() || (statement.getResultSet() != null // result set doesn't exist for prepared statement cases && statement.getResultSet().isClosed())) { throw new AlreadyClosedSqlException( "ResultSetMetaData's ResultSet is already closed." ); } }
@Override protected Statement newInstance() throws Exception { UnregisteredDriver driver = new TestDriver(); AvaticaConnection connection = new AvaticaConnection(driver, driver.createFactory(), "jdbc:avatica", new Properties()) { }; StatementHandle handle = mock(StatementHandle.class); AvaticaStatement statement = new AvaticaStatement(connection, handle, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT) { }; statement.close(); assertTrue("Statement is not closed", statement.isClosed()); return statement; } }
@Override protected Statement newInstance() throws Exception { UnregisteredDriver driver = new TestDriver(); AvaticaConnection connection = new AvaticaConnection(driver, driver.createFactory(), "jdbc:avatica", new Properties()) { }; StatementHandle handle = mock(StatementHandle.class); AvaticaStatement statement = new AvaticaStatement(connection, handle, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT) { }; statement.close(); assertTrue("Statement is not closed", statement.isClosed()); return statement; } }