Statement getMoreResults - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Statement getMoreResults method.

This code example shows how to use the following methods:execute, getMoreResults, getResultSet, getUpdateCount
        rs.close();
    } 
 
    @Test 
    public void execute() throws SQLException { 
        assertTrue(stat.execute("select null;"));
        ResultSet rs = stat.getResultSet();
        assertNotNull(rs);
        assertTrue(rs.next());
        assertNull(rs.getString(1));
        assertTrue(rs.wasNull());
        assertFalse(stat.getMoreResults());
        assertEquals(stat.getUpdateCount(), -1);
 
        assertTrue(stat.execute("select null;"));
        assertFalse(stat.getMoreResults());
        assertEquals(stat.getUpdateCount(), -1);
 
        assertFalse(stat.execute("create table test (c1);"));
        assertEquals(stat.getUpdateCount(), 0);

6
CodeRank
This code example shows how to use the following methods:getGeneratedKeys, getMoreResults, getResultSet, getUpdateCount
            { 
                if (!processedGeneratedKeyResultSet)
                { 
                    if (retrieveAutoGeneratedKeys()) 
                    { 
                        generatedKeys = statement.getGeneratedKeys();
                        processedGeneratedKeyResultSet = true;
                    } 
                    else 
                    { 
                        processedGeneratedKeyResultSet = true;
                    } 
                } 
 
                if (generatedKeys == null)
                { 
                    moveToNextResult(); 
                } 
            } 
            else 

6
CodeRank
This code example shows how to use the following methods:closeOnCompletion, execute, getMoreResults, getResultSet, isClosed
     * Test the behavior of closeOnCompletion with a multiple result sets 
     */ 
    public void testMultipleResultSet() throws SQLExceptionStatement stmt = _conn.createStatement();
        stmt.closeOnCompletion();
 
        stmt.execute(TestUtil.selectSQL("table1", "*") + ";" + 
                     TestUtil.selectSQL("table1", "*") + ";"); 
        ResultSet rs = stmt.getResultSet();
        rs.close();
        assertFalse(stmt.isClosed());
        stmt.getMoreResults();
        rs = stmt.getResultSet();
        rs.close();
        assertTrue(stmt.isClosed());
    } 
 
    /** 
     * Test that when execution does not produce any result sets,  
     * closeOnCompletion has no effect (spec)   
7
CodeRank
This code example shows how to use the following methods:execute, setInt, setString, close, getMoreResults
            Connection connection = node.getDataSource().getConnection();
            try { 
                CallableStatement statement = connection
                        .prepareCall("{call auto_pk_for_table(?, ?)}");
                try { 
                    statement.setString(1, entity.getName());
                    statement.setInt(2, super.getPkCacheSize());
 
                    // can't use "executeQuery" 
                    // per http://jtds.sourceforge.net/faq.html#expectingResultSet 
                    statement.execute();
                    if (statement.getMoreResults()) {
                        ResultSet rs = statement.getResultSet();
 
                        try { 
                            if (rs.next()) {
                                return rs.getLong(1);
                            } 
                            else { 
                                throw new CayenneRuntimeException( 

6
CodeRank
This code example shows how to use the following methods:getMoreResults
        return delegate.getUpdateCount();
    } 
 
    @Override 
    public boolean getMoreResults() throws SQLException {
        return delegate.getMoreResults();
    } 
 
    @Override 
    public void setFetchDirection(int direction) throws SQLException {
        delegate.setFetchDirection(direction);
    } 
 
    @Override 
    public int getFetchDirection() throws SQLException {
        return delegate.getFetchDirection();
    } 
 
    @Override 
    public void setFetchSize(int rows) throws SQLException {
5
CodeRank
This code example shows how to use the following methods:execute, setDouble, close, getMoreResults, getResultSet
    assertEquals(42.42, call.getDouble(1), 0.00001);
    call.close();
 
    // test without an out parameter 
    call = con.prepareCall("{ call " + pkgName + "getDouble(?) }");
    call.setDouble(1, 3.04);
    call.execute();
    assertEquals(-1, call.getUpdateCount());
    ResultSet rs = call.getResultSet();
    assertNotNull(rs);
    assertTrue(rs.next());
    assertEquals(42.42, rs.getDouble(1), 0.00001);
    assertTrue(!rs.next());
    rs.close();
 
    assertEquals(-1, call.getUpdateCount());
    assertTrue(!call.getMoreResults());
    call.close();
  } 
 

4
CodeRank
This code example shows how to use the following methods:getMoreResults
  public Connection getConnection() throws SQLException {
    return delegate.getConnection();
  } 
 
  public boolean getMoreResults(int current) throws SQLException {
    return delegate.getMoreResults(current);
  } 
 
  public ResultSet getGeneratedKeys() throws SQLException {
    return delegate.getGeneratedKeys();
  } 
 
  public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException {
    return delegate.executeUpdate(sql, autoGeneratedKeys);
  } 
 
  public int executeUpdate(String sql, int[] columnIndexes) throws SQLException {
    return delegate.executeUpdate(sql, columnIndexes);
  } 
 
4
CodeRank
This code example shows how to use the following methods:toString, getMoreResults
    public int getUpdateCount() throws SQLException
    { checkOpen(); try { return _stmt.getUpdateCount(); } catch (SQLException e) { handleException(e); return 0; } }
 
    @Override 
    public boolean getMoreResults() throws SQLException
    { checkOpen(); try { return _stmt.getMoreResults(); } catch (SQLException e) { handleException(e); return false; } }
 
    @Override 
    public void setFetchDirection(int direction) throws SQLException
    { checkOpen(); try { _stmt.setFetchDirection(direction); } catch (SQLException e) { handleException(e); } }
 
    @Override 
    public int getFetchDirection() throws SQLException
    { checkOpen(); try { return _stmt.getFetchDirection(); } catch (SQLException e) { handleException(e); return 0; } }
 
    @Override 
    public void setFetchSize(int rows) throws SQLException
    { checkOpen(); try { _stmt.setFetchSize(rows); } catch (SQLException e) { handleException(e); } }
 
    @Override 

5
CodeRank
This code example shows how to use the following methods:getMoreResults
	 
	/** 
	 * Standard Statement method call.  
	 */ 
	public boolean getMoreResults() throws SQLException {
		return pstmt.getMoreResults();
	} 
 
	/** 
	 * Standard Statement method call.  
	 */ 
	public int getQueryTimeout() throws SQLException {
		return pstmt.getQueryTimeout();
	} 
 
	/** 
	 * Standard Statement method call.  
	 */ 
	public ResultSet getResultSet() throws SQLException {
		return pstmt.getResultSet();
4
CodeRank
This code example shows how to use the following methods:getMoreResults
		return stat.getMaxRows();
	} 
 
	@Override 
	public boolean getMoreResults() throws SQLException {
		return stat.getMoreResults();
	} 
 
	@Override 
	public boolean getMoreResults(int current) throws SQLException {
		return stat.getMoreResults(current);
	} 
 
	@Override 
	public int getQueryTimeout() throws SQLException {
		return stat.getQueryTimeout();
	} 
 
	@Override 
	public int getResultSetConcurrency() throws SQLException {
5
CodeRank
getMoreResults Method Overview
Moves to this Statement object's next result, deals with any current ResultSet object(s) according to the instructions specified by the given flag, and returns true if the next result is a ResultSet object.
See Code Examples for other Java 8 Statement Methods: