View Javadoc

    1   package sharin.sql.runner.processor;
    2
    3   import java.sql.ResultSet;
    4
    5   import sharin.sql.runner.ColumnConverter;
    6   import sharin.sql.runner.ResultSetProcessor;
    7
    8   public class ScalarResultSetProcessor implements ResultSetProcessor {
    9
    10      private final ColumnConverter columnConverter;
    11
    12      public ScalarResultSetProcessor(ColumnConverter columnConverter) {
    13          this.columnConverter = columnConverter;
    14      }
    15
    16      public Object prepare(ResultSet rs) {
    17          return null;
    18      }
    19
    20      public Object process(ResultSet rs, Object context) {
    21          return columnConverter.convert(rs, 1);
    22      }
    23  }