Automattic\WooCommerce\Internal\DataStores\Orders

OrdersTableQuery::run_query()privateWC 1.0

Runs the SQL query.

Method of the class: OrdersTableQuery{}

No Hooks.

Return

null. Nothing (null).

Usage

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

OrdersTableQuery::run_query() code WC 8.6.1

private function run_query(): void {
	global $wpdb;

	// Run query.
	$this->orders = array_map( 'absint', $wpdb->get_col( $this->sql ) ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared

	// Set max_num_pages and found_orders if necessary.
	if ( ( $this->arg_isset( 'no_found_rows' ) && ! $this->args['no_found_rows'] ) || empty( $this->orders ) ) {
		return;
	}

	if ( $this->limits ) {
		$this->found_orders  = absint( $wpdb->get_var( $this->count_sql ) ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
		$this->max_num_pages = (int) ceil( $this->found_orders / $this->args['limit'] );
	} else {
		$this->found_orders = count( $this->orders );
	}
}