public Table executeAndFetchTable() { LazyTable lt = executeAndFetchTableLazy(); List<Row> rows = new ArrayList<>(); try { for (Row item : lt.rows()) { rows.add(item); } } finally { lt.close(); } // lt==null is always false return new Table(lt.getName(), rows, lt.columns()); }
public LazyTable executeAndFetchTableLazy() { final LazyTable lt = new LazyTable(); lt.setRows( new ResultSetIterableBase<Row>() { public Iterator<Row> iterator() { return new TableResultSetIterator( rs, isCaseSensitive(), getConnection().getSql2o().getQuirks(), lt); } }); return lt; }