Package redempt.redlib.sql
Class SQLHelper.Results
java.lang.Object
redempt.redlib.sql.SQLHelper.Results
- All Implemented Interfaces:
 AutoCloseable
- Enclosing class:
 - SQLHelper
 
Wraps a 
ResultSet with easier use- 
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the wrapped ResultSet.voidforEach(Consumer<SQLHelper.Results> lambda) Performs an operation on every row in these Results, passing itself each time it iterates to a new row<T> Tget(int column) Gets an Object in the given column in the current rowbyte[]getBytes(int column) Gets the bytes in the given column in the current rowintGets the column count from the returned datagetLong(int column) Gets a Long in the given column in the current rowgetString(int column) Gets a String in the given column in the current rowbooleanisEmpty()booleannext()Moves to the next row in the wrapped ResultSet. 
- 
Method Details
- 
isEmpty
public boolean isEmpty()- Returns:
 - False if the first call of 
ResultSet.next()on the wrapped ResultSet returned false, true otherwise 
 - 
next
public boolean next()Moves to the next row in the wrapped ResultSet. Note that this method is called immediately when the Results object is constructed, and does not need to be called to retrieve the items in the first row.- Returns:
 - True if there is another row available in the wrapped ResultSet
 
 - 
forEach
Performs an operation on every row in these Results, passing itself each time it iterates to a new row- Parameters:
 lambda- The callback to be run on every row in these Results
 - 
get
public <T> T get(int column) Gets an Object in the given column in the current row- Type Parameters:
 T- The type to cast the return value to- Parameters:
 column- The index of the column to get, starting at 1- Returns:
 - The value in the column
 
 - 
getBytes
public byte[] getBytes(int column) Gets the bytes in the given column in the current row- Parameters:
 column- The index of the column to get, starting at 1- Returns:
 - The bytes in the column
 
 - 
getString
Gets a String in the given column in the current row- Parameters:
 column- The index of the column to get, starting at 1- Returns:
 - The String in the column
 Note: This method exists because 
ResultSet.getObject(int)can return an Integer if the String in the column can be parsed into one. 
 - 
getLong
Gets a Long in the given column in the current row- Parameters:
 column- The index of the column to get, starting at 1- Returns:
 - The String in the column
 Note: This method exists because 
ResultSet.getObject(int)can return an Integer if the Long in the column can be parsed into one. 
 - 
getColumnCount
public int getColumnCount()Gets the column count from the returned data- Returns:
 - The column count
 
 - 
close
public void close()Closes the wrapped ResultSet. Call this when you are done using these Results.- Specified by:
 closein interfaceAutoCloseable
 
 -