public static <T>List<T> select(Connection connection,String rawSqlQuery,RowProcessor<T> rowProcessor,Object... parameters) throws IOException, SQLException {
  PreparedStatement stmt=null;
  ResultSet rs=null;
  try {
    stmt=connection.prepareStatement(rawSqlQuery);
    for (int index=0; index < parameters.length; index++) {
      JdbcUtils.bindParameter(stmt,index + 1,parameters[index]);
    }
    rs=stmt.executeQuery();
    List<T> result=Lists.newLinkedList();
    while (rs.next()) {
      result.add(rowProcessor.process(rs));
    }
    return result;
  }
  finally {
    JdbcUtils.closeResultSet(rs);
    JdbcUtils.closeStatement(stmt);
  }
}

public static < T > List < T > select ( Connection connection , String rawSqlQuery , RowProcessor < T > rowProcessor , Object ... parameters ) throws IOException , SQLException { PreparedStatement stmt = null ; ResultSet rs = null ; try { stmt = connection . prepareStatement ( rawSqlQuery ) ; for ( int index = 0 ; index < parameters . length ; index ++ ) { JdbcUtils . bindParameter ( stmt , index + 1 , parameters [ index ] ) ; } rs = stmt . executeQuery ( ) ; List < T > result = Lists . newLinkedList ( ) ; while ( rs . next ( ) ) { result . add ( rowProcessor . process ( rs ) ) ; } return result ; } finally { JdbcUtils . closeResultSet ( rs ) ; JdbcUtils . closeStatement ( stmt ) ; } }
retrieve all the rows satisfying the given sql query .
