@FunctionalInterface public interface RowConsumer
This provides a low level option that reads directly from the JDBC ResultSet.
String sql = "select id, name, status from o_customer order by name desc";
DB.sqlQuery(sql)
.findEachRow((resultSet, rowNum) -> {
// read directly from ResultSet
long id = resultSet.getLong(1);
String name = resultSet.getString(2);
// do something interesting with the data
});
Modifier and Type | Method and Description |
---|---|
void |
accept(ResultSet resultSet,
int rowNum)
Read the data from the ResultSet and process it.
|
void accept(ResultSet resultSet, int rowNum) throws SQLException
resultSet
- The JDBC ResultSet positioned to the current rowrowNum
- The number of the current row being mapped.SQLException
Copyright © 2019. All rights reserved.