WP_CLI\Iterators

Query::load_items_from_db()privateWP-CLI 1.0

Method of the class: Query{}

No Hooks.

Return

null. Nothing.

Usage

// private - for code of main (parent) class only
$result = $this->load_items_from_db();

Query::load_items_from_db() code WP-CLI 2.8.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;
}