WP_CLI\Iterators
Query::load_items_from_db
Method of the class: Query{}
No Hooks.
Returns
null. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->load_items_from_db();
Query::load_items_from_db() Query::load items from db code WP-CLI 2.13.0-alpha
private function load_items_from_db() {
$this->adjust_offset_for_shrinking_result_set();
$query = $this->query . sprintf( ' LIMIT %d OFFSET %d', $this->chunk_size, $this->offset );
$this->results = $this->db->get_results( $query );
if ( ! $this->results ) {
if ( $this->db->last_error ) {
throw new Exception( 'Database error: ' . $this->db->last_error );
}
return false;
}
$this->offset += $this->chunk_size;
return true;
}