protected function query() {
		$results = $this->wpdb->get_results( $this->sql );

		// we query for found rows first to prevent instantiation of record objects from interfering with the count
		if ( $this->args['sql_calc_found_rows'] ) {

			$count_results     = $this->wpdb->get_results( "SELECT FOUND_ROWS() AS COUNT" );

			if ( empty( $count_results ) || empty( $count_results[0] ) ) {
				$this->total_items = 0;
			} else {
				$this->total_items = $count_results[0]->COUNT;
			}

		} elseif ( $this->args['return_value'] == 'count' ) {

			if ( empty( $results ) || empty( $results[0] ) ) {
				$this->total_items = 0;
			} else {
				$this->total_items = $results[0]->COUNT;
			}
		}

		$this->results = $this->parse_results( $results );
	}