|
|
|
|
@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
|
|
|
|
|
/* |
|
|
|
|
* Copyright 2002-2016 the original author or authors. |
|
|
|
|
* Copyright 2002-2023 the original author or authors. |
|
|
|
|
* |
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
|
@ -20,15 +20,17 @@ import java.sql.ResultSet;
@@ -20,15 +20,17 @@ import java.sql.ResultSet;
|
|
|
|
|
import java.sql.SQLException; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* An interface used by {@link JdbcTemplate} for processing rows of a |
|
|
|
|
* An interface used by {@link JdbcTemplate} and |
|
|
|
|
* {@link org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate |
|
|
|
|
* NamedParameterJdbcTemplate} for processing rows of a |
|
|
|
|
* {@link java.sql.ResultSet} on a per-row basis. Implementations of |
|
|
|
|
* this interface perform the actual work of processing each row |
|
|
|
|
* but don't need to worry about exception handling. |
|
|
|
|
* {@link java.sql.SQLException SQLExceptions} will be caught and handled |
|
|
|
|
* by the calling JdbcTemplate. |
|
|
|
|
* by the calling {@code JdbcTemplate} or {@code NamedParameterJdbcTemplate}. |
|
|
|
|
* |
|
|
|
|
* <p>In contrast to a {@link ResultSetExtractor}, a RowCallbackHandler |
|
|
|
|
* object is typically stateful: It keeps the result state within the |
|
|
|
|
* <p>In contrast to a {@link ResultSetExtractor}, a {@code RowCallbackHandler} |
|
|
|
|
* object is typically stateful: it keeps the result state within the |
|
|
|
|
* object, to be available for later inspection. See |
|
|
|
|
* {@link RowCountCallbackHandler} for a usage example. |
|
|
|
|
* |
|
|
|
|
@ -38,6 +40,7 @@ import java.sql.SQLException;
@@ -38,6 +40,7 @@ import java.sql.SQLException;
|
|
|
|
|
* @author Rod Johnson |
|
|
|
|
* @author Juergen Hoeller |
|
|
|
|
* @see JdbcTemplate |
|
|
|
|
* @see org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate NamedParameterJdbcTemplate |
|
|
|
|
* @see RowMapper |
|
|
|
|
* @see ResultSetExtractor |
|
|
|
|
* @see RowCountCallbackHandler |
|
|
|
|
@ -47,14 +50,15 @@ public interface RowCallbackHandler {
@@ -47,14 +50,15 @@ public interface RowCallbackHandler {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Implementations must implement this method to process each row of data |
|
|
|
|
* in the ResultSet. This method should not call {@code next()} on |
|
|
|
|
* the ResultSet; it is only supposed to extract values of the current row. |
|
|
|
|
* in the {@link ResultSet}. This method should not call {@code next()} on |
|
|
|
|
* the {@code ResultSet}; it is only supposed to extract values of the current |
|
|
|
|
* row. |
|
|
|
|
* <p>Exactly what the implementation chooses to do is up to it: |
|
|
|
|
* A trivial implementation might simply count rows, while another |
|
|
|
|
* a trivial implementation might simply count rows, while another |
|
|
|
|
* implementation might build an XML document. |
|
|
|
|
* @param rs the ResultSet to process (pre-initialized for the current row) |
|
|
|
|
* @throws SQLException if an SQLException is encountered getting |
|
|
|
|
* column values (that is, there's no need to catch SQLException) |
|
|
|
|
* @param rs the {@code ResultSet} to process (pre-initialized for the current row) |
|
|
|
|
* @throws SQLException if an {@code SQLException} is encountered getting |
|
|
|
|
* column values (that is, there's no need to catch {@code SQLException}) |
|
|
|
|
*/ |
|
|
|
|
void processRow(ResultSet rs) throws SQLException; |
|
|
|
|
|
|
|
|
|
|