// Always sort by the high water field, to ensure that the first run
// (before we have a high water value) also has the results in a
// consistent order.
$this->query->
orderBy($high_water_field);
} if ($condition_added) { $this->query->
condition($conditions);
} // If the query has a group by, our added fields need it too, to keep the
// query valid.
// @see https://dev.mysql.com/doc/refman/5.7/en/group-by-handling.html
$group_by =
$this->query->
getGroupBy();
if ($group_by &&
$added_fields) { foreach ($added_fields as $added_field) { $this->query->
groupBy($added_field);
} } } // Download data in batches for performance.
if (($this->batchSize > 0
)) { $this->query->
range($this->batch *
$this->batchSize,
$this->batchSize
);
}