Package scriptella.jdbc
Class ResultSetAdapter
java.lang.Object
scriptella.jdbc.ResultSetAdapter
- All Implemented Interfaces:
Closeable,AutoCloseable,ParametersCallback
Represents SQL query result set as
ParametersCallback.
This class exposes pseudo column rownum -current row number starting at 1.
- Version:
- 1.0
- Author:
- Fyodor Kupolov
-
Constructor Summary
ConstructorsConstructorDescriptionResultSetAdapter(ResultSet resultSet, ParametersCallback parametersCallback, scriptella.jdbc.JdbcTypesConverter converter) Instantiates an adapter, prepares a cache and builds a map of column names. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the underlying resultset.getParameter(String name) Returns the value of parameter specified by name.booleannext()
-
Constructor Details
-
ResultSetAdapter
public ResultSetAdapter(ResultSet resultSet, ParametersCallback parametersCallback, scriptella.jdbc.JdbcTypesConverter converter) Instantiates an adapter, prepares a cache and builds a map of column names.- Parameters:
resultSet- resultset to adapt.parametersCallback- parent parameter callback.converter- type converter to use for getting column values as object.
-
-
Method Details
-
next
public boolean next()- Returns:
- true if the new current row is valid; false if there are no more rows
- See Also:
-
getParameter
Description copied from interface:ParametersCallbackReturns the value of parameter specified by name.The callback internally delegates a call to parent callbacks if the parameter cannot be found.
- Specified by:
getParameterin interfaceParametersCallback- Parameters:
name- parameter name. Providers are allowed (but not required) to ignore a case of the name parameter to comply with their internal model. For example JDBC drivers are case-insensitive to column names.- Returns:
- parameter value or null if parameter doesn't exist.
-
close
public void close()Closes the underlying resultset.This method should operate without raising exceptions.
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-