question: public void query ( String sql , StatementVisitor statement , ResultSetVisitor resultsetVisitor ) throws SQLException { Connection connection = null ; PreparedStatement stmt = null ; ResultSet resultSet = null ; try { connection = source . getConnection ( ) ; stmt = connection . prepareStatement ( sql ) ; if ( statement != null ) { statement . visit ( stmt ) ; } resultSet = stmt . executeQuery ( ) ; while ( resultSet . next ( ) ) { if ( ! resultsetVisitor . visit ( resultSet ) ) { return ; } } resultSet . close ( ) ; } finally { SQLUtil . closeQuietly ( resultSet ) ; SQLUtil . closeQuietly ( stmt ) ; SQLUtil . closeQuietly ( connection ) ; } }
target:  Perform SQL query and let visitor handle results. If the SQL string contains ? placeholders, use the StatementVisitor to update the PreparedStatement with actual values.