Class ResultSetAdapter

java.lang.Object
scriptella.jdbc.ResultSetAdapter
All Implemented Interfaces:
Closeable, AutoCloseable, ParametersCallback

public class ResultSetAdapter extends Object implements ParametersCallback, Closeable
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 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

      public Object getParameter(String name)
      Description copied from interface: ParametersCallback
      Returns the value of parameter specified by name.

      The callback internally delegates a call to parent callbacks if the parameter cannot be found.

      Specified by:
      getParameter in interface ParametersCallback
      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:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable