Java 8 ResultSet - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 ResultSet class.

This code example shows how to use the following methods: close
 
    public void close() { 
        if (result != null) {
            try { 
                next = null;
                result.close();
                result = null;
            } catch (SQLException ex) {
                result = null;
                throw new RuntimeException(ex);
            } 
        } 
    } 
 
    public static void close(Iterator<?> iterator) {
        if (iterator instanceof JdbcIterator<?>) ((JdbcIterator<?>)iterator).close();
    } 
 
 
    protected void load() { 
Full Snippet Info
10
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: close, getInt, next
 
        Statement statement = shadowOf(database).getConnection().createStatement();
        final String select = "SELECT COUNT(*) FROM table_name";
 
        ResultSet rs = statement.executeQuery(select);
        assertThat(rs.next()).isTrue();
        assertThat(rs.getInt(1)).isEqualTo(1);
        rs.close();
 
        assertThat(shDatabase.isTransactionSuccess()).isFalse();
        database.endTransaction();
 
        statement = shadowOf(database).getConnection().createStatement();
        rs = statement.executeQuery(select);
        assertThat(rs.next()).isTrue();
        assertThat(rs.getInt(1)).isEqualTo(0);
 
        assertThat(shDatabase.isTransactionSuccess()).isFalse();
    } 
 
Full Snippet Info
10
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: close, next
 
    public void close() { 
        if (result != null) {
            try { 
                next = null;
                result.close();
                result = null;
            } catch (SQLException ex) {
                result = null;
                throw new RuntimeException(ex);
            } 
        } 
    } 
 
    public static void close(Iterator<?> iterator) {
        if (iterator instanceof JdbcIterator<?>) ((JdbcIterator<?>) iterator).close();
    } 
 
 
    protected void load() { 

10
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: next
	  try 
	  { 
		  stmt = conn.createStatement();
		  rs = stmt.executeQuery(query);
 
		  if ( rs.next() )
		  { 
			  res = rs.getLong(1);
		  } 
	  } finally { 
		  DBHelper.close(rs,stmt,null);
	  } 
	  return res;
  } 
 
 
  /** 
   * 
   * @param query: that expects to return a single long 
   * @param defaultVal: value to be returned if there is an error in query or if a null result was found 
Full Snippet Info
10
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: close, getInt, next
    ResultSet res = tpch.execute("select 100 * sum(" +
        "case when p_type like 'PROMO%' then l_extendedprice else 0.0 end) / sum(l_extendedprice * (1 - l_discount)) " 
        + "as promo_revenue from lineitem, part where l_partkey = p_partkey"); 
 
    try { 
      assertTrue(res.next());
      assertEquals(33, res.getInt(1));
    } finally { 
      res.close();
    } 
  } 
} 
Full Snippet Info
9
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Java 8 ResultSet Questions & Answers:

See Code Examples for Java 8 ResultSet Methods: