@Override public void close() { // Note: No already-closed exception for close(). super.close(); }
@Override public void close() { // Note: No already-closed exception for close(). super.close(); }
@Override public void close() { // Note: No already-closed exception for close(). super.close(); }
public void clear() throws SQLException { if (statement.openResultSet != null) { final AvaticaResultSet rs = statement.openResultSet; statement.openResultSet = null; try { rs.close(); } catch (Exception e) { throw HELPER.createException( "Error while closing previous result set", e); } } }
public void clear() throws SQLException { if (statement.openResultSet != null) { final AvaticaResultSet rs = statement.openResultSet; statement.openResultSet = null; try { rs.close(); } catch (Exception e) { throw HELPER.createException( "Error while closing previous result set", e); } } }
public void clear() throws SQLException { if (statement.openResultSet != null) { final AvaticaResultSet rs = statement.openResultSet; statement.openResultSet = null; try { rs.close(); } catch (Exception e) { throw helper.createException( "Error while closing previous result set", e); } } }
protected void close_() { if (!closed) { closed = true; if (openResultSet != null) { AvaticaResultSet c = openResultSet; openResultSet = null; c.close(); } try { // inform the server to close the resource connection.meta.closeStatement(handle); } finally { // make sure we don't leak on our side connection.statementMap.remove(handle.id); connection.flagMap.remove(handle.id); } // If onStatementClose throws, this method will throw an exception (later // converted to SQLException), but this statement still gets closed. connection.driver.handler.onStatementClose(this); } }
protected void close_() { if (!closed) { closed = true; if (openResultSet != null) { AvaticaResultSet c = openResultSet; openResultSet = null; c.close(); } try { // inform the server to close the resource connection.meta.closeStatement(handle); } finally { // make sure we don't leak on our side connection.statementMap.remove(handle.id); connection.flagMap.remove(handle.id); } // If onStatementClose throws, this method will throw an exception (later // converted to SQLException), but this statement still gets closed. connection.driver.handler.onStatementClose(this); } }
protected void close_() { if (!closed) { closed = true; if (openResultSet != null) { AvaticaResultSet c = openResultSet; openResultSet = null; c.close(); } try { // inform the server to close the resource connection.meta.closeStatement(handle); } finally { // make sure we don't leak on our side connection.statementMap.remove(handle.id); } // If onStatementClose throws, this method will throw an exception (later // converted to SQLException), but this statement still gets closed. connection.driver.handler.onStatementClose(this); } }
@Override protected void close_() { if (!closed) { closed = true; final QuarkConnectionImpl connection1 = (QuarkConnectionImpl) connection; connection1.server.removeStatement(handle); if (openResultSet != null) { AvaticaResultSet c = openResultSet; openResultSet = null; c.close(); } // If onStatementClose throws, this method will throw an exception (later // converted to SQLException), but this statement still gets closed. connection1.getDriver().handler.onStatementClose(this); } } }
public boolean getMoreResults(int current) throws SQLException { checkOpen(); switch (current) { case KEEP_CURRENT_RESULT: case CLOSE_ALL_RESULTS: throw AvaticaConnection.HELPER.unsupported(); case CLOSE_CURRENT_RESULT: break; default: throw AvaticaConnection.HELPER.createException("value " + current + " is not one of CLOSE_CURRENT_RESULT, KEEP_CURRENT_RESULT or CLOSE_ALL_RESULTS"); } if (openResultSet != null) { openResultSet.close(); } return false; }
public boolean getMoreResults(int current) throws SQLException { checkOpen(); switch (current) { case KEEP_CURRENT_RESULT: case CLOSE_ALL_RESULTS: throw AvaticaConnection.HELPER.unsupported(); case CLOSE_CURRENT_RESULT: break; default: throw AvaticaConnection.HELPER.createException("value " + current + " is not one of CLOSE_CURRENT_RESULT, KEEP_CURRENT_RESULT or CLOSE_ALL_RESULTS"); } if (openResultSet != null) { openResultSet.close(); } return false; }
@Test public void testGetMoreResults() throws SQLException { AvaticaResultSet resultSet = mock(AvaticaResultSet.class); statement.openResultSet = resultSet; doCallRealMethod().when(statement).onResultSetClose(any(ResultSet.class)); when(statement.getMoreResults()).thenCallRealMethod(); when(statement.getMoreResults(anyInt())).thenCallRealMethod(); assertFalse(statement.getMoreResults()); verify(resultSet).close(); } }
@Test public void testGetMoreResults() throws SQLException { AvaticaResultSet resultSet = mock(AvaticaResultSet.class); statement.openResultSet = resultSet; doCallRealMethod().when(statement).onResultSetClose(any(ResultSet.class)); when(statement.getMoreResults()).thenCallRealMethod(); when(statement.getMoreResults(anyInt())).thenCallRealMethod(); assertFalse(statement.getMoreResults()); verify(resultSet).close(); } }
statement.openResultSet = null; try { rs.close(); } catch (Exception e) { throw helper.createException(
@Override protected ResultSet 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) { }; Signature signature = new Signature(Collections.emptyList(), "", Collections.emptyList(), Collections.emptyMap(), null, Meta.StatementType.SELECT); AvaticaResultSet resultSet = new AvaticaResultSet(statement, new QueryState(""), signature, null, DateTimeUtils.UTC_ZONE, null); resultSet.close(); assertTrue("Resultset is not closed", resultSet.isClosed()); return resultSet; } }
statement.openResultSet = null; try { rs.close(); } catch (Exception e) { throw HELPER.createException(
@Override protected ResultSet 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) { }; Signature signature = new Signature(Collections.emptyList(), "", Collections.emptyList(), Collections.emptyMap(), null, Meta.StatementType.SELECT); AvaticaResultSet resultSet = new AvaticaResultSet(statement, new QueryState(""), signature, null, DateTimeUtils.UTC_ZONE, null); resultSet.close(); assertTrue("Resultset is not closed", resultSet.isClosed()); return resultSet; } }
statement.openResultSet = null; try { rs.close(); } catch (Exception e) { throw HELPER.createException(