java.lang.Object
de.chojo.sadu.mapper.util.Results
Utility class to handle and extract data from
ResultSet
s and ResultSetMetaData
-
Method Summary
Modifier and TypeMethodDescriptioncolumnNames
(ResultSet set) Get a set of column names in this result setcolumnNames
(ResultSetMetaData meta) Get a set of column names in this result setcolumnTypes
(ResultSetMetaData meta) generatedKeys
(Statement stmt) getFirstColumnIndexOfType
(ResultSetMetaData meta, List<SqlType> types) Extracts the column index (1 based) of the first column with the requested type.
-
Method Details
-
columnNames
Get a set of column names in this result set- Parameters:
set
- result set.- Returns:
- set of column names.
- Throws:
SQLException
- if a database access error occurs.
-
columnNames
Get a set of column names in this result set- Parameters:
meta
- result set meta.- Returns:
- set of column names.
- Throws:
SQLException
- if a database access error occurs.
-
getFirstColumnIndexOfType
public static Optional<Integer> getFirstColumnIndexOfType(ResultSetMetaData meta, List<SqlType> types) throws SQLException Extracts the column index (1 based) of the first column with the requested type.- Parameters:
meta
- meta of the result settypes
- a list of valid types where the index will be returned- Returns:
- the index of the column with the first type contained in types
- Throws:
SQLException
- if a database access error occurs
-
columnTypes
- Throws:
SQLException
-
generatedKeys
- Throws:
SQLException
-