/** * Moving forward through the results it's expected that the batches are arbitrarily size. * Moving backward through the results it's expected that the batches will match the fetch size. */ public List<?> getCurrentRow() throws SQLException { if (currentRow != null) { return currentRow; } if (this.currentRowNumber == 0 || (lastRowNumber != -1 && this.currentRowNumber > lastRowNumber)) { return null; } for (int i = 0; i < batches.size(); i++) { Batch batch = batches.get(i); if (this.currentRowNumber < batch.getBeginRow()) { continue; } if (this.currentRowNumber > batch.getEndRow()) { continue; } if (i != 0) { batches.add(0, batches.remove(i)); } setCurrentRow(batch); return currentRow; } requestBatchAndWait(this.currentRowNumber); Batch batch = batches.get(0); setCurrentRow(batch); return currentRow; }
/** * Moving forward through the results it's expected that the batches are arbitrarily size. * Moving backward through the results it's expected that the batches will match the fetch size. */ public List<?> getCurrentRow() throws SQLException { if (currentRow != null) { return currentRow; } if (this.currentRowNumber == 0 || (lastRowNumber != -1 && this.currentRowNumber > lastRowNumber)) { return null; } for (int i = 0; i < batches.size(); i++) { Batch batch = batches.get(i); if (this.currentRowNumber < batch.getBeginRow()) { continue; } if (this.currentRowNumber > batch.getEndRow()) { continue; } if (i != 0) { batches.add(0, batches.remove(i)); } setCurrentRow(batch); return currentRow; } requestBatchAndWait(this.currentRowNumber); Batch batch = batches.get(0); setCurrentRow(batch); return currentRow; }
public Boolean hasNext(int next, boolean wait) throws SQLException { while (this.currentRowNumber + next > highestRowNumber && lastRowNumber == -1) { if (!wait) { return null; } requestNextBatch(); } boolean result = this.currentRowNumber + next <= highestRowNumber; if (result && !wait) { for (int i = 0; i < batches.size(); i++) { Batch batch = batches.get(i); if (this.currentRowNumber + next < batch.getBeginRow()) { continue; } if (this.currentRowNumber + next> batch.getEndRow()) { continue; } return Boolean.TRUE; } return null; //needs to be fetched } return result; }
public Boolean hasNext(int next, boolean wait) throws SQLException { while (this.currentRowNumber + next > highestRowNumber && lastRowNumber == -1) { if (!wait) { return null; } requestNextBatch(); } boolean result = this.currentRowNumber + next <= highestRowNumber; if (result && !wait) { for (int i = 0; i < batches.size(); i++) { Batch batch = batches.get(i); if (this.currentRowNumber + next < batch.getBeginRow()) { continue; } if (this.currentRowNumber + next> batch.getEndRow()) { continue; } return Boolean.TRUE; } return null; //needs to be fetched } return result; }