OrdersTableQuery::build_count_query()privateWC 1.0

Build SQL query for counting total number of results.

Метод класса: OrdersTableQuery{}

Хуков нет.


null. Ничего.


// private - только в коде основоного (родительского) класса
$result = $this->build_count_query( $fields, $join, $where, $groupby );
$fields(строка) (обязательный)
Prepared fields for SELECT clause.
$join(строка) (обязательный)
Prepared JOIN clause.
$where(строка) (обязательный)
Prepared WHERE clause.
$groupby(строка) (обязательный)
Prepared GROUP BY clause.

Код OrdersTableQuery::build_count_query() WC 7.3.0

private function build_count_query( $fields, $join, $where, $groupby ) {
	if ( ! isset( $this->sql ) || '' === $this->sql ) {
		wc_doing_it_wrong( __FUNCTION__, 'Count query can only be build after main query is built.', '7.3.0' );
	$orders_table    = $this->tables['orders'];
	$this->count_sql = "SELECT COUNT(DISTINCT $fields) FROM  $orders_table $join WHERE $where $groupby";