001package io.ebean; 002 003import java.sql.ResultSet; 004import java.sql.SQLException; 005 006/** 007 * Used with SqlQuery to process potentially large queries reading directly from the JDBC ResultSet. 008 * <p> 009 * This provides a low level option that reads directly from the JDBC ResultSet. 010 * </p> 011 * 012 * <pre>{@code 013 * 014 * String sql = "select id, name, status from o_customer order by name desc"; 015 * 016 * DB.sqlQuery(sql) 017 * .findEachRow((resultSet, rowNum) -> { 018 * 019 * // read directly from ResultSet 020 * 021 * long id = resultSet.getLong(1); 022 * String name = resultSet.getString(2); 023 * 024 * // do something interesting with the data 025 * 026 * }); 027 * 028 * }</pre> 029 */ 030@FunctionalInterface 031public interface RowConsumer { 032 033 /** 034 * Read the data from the ResultSet and process it. 035 * 036 * @param resultSet The JDBC ResultSet positioned to the current row 037 * @param rowNum The number of the current row being mapped. 038 */ 039 void accept(ResultSet resultSet, int rowNum) throws SQLException; 040}