wpdb::flush()

In this article

Kills cached query results.

Source

public function flush() {
	$this->last_result   = array();
	$this->col_info      = null;
	$this->last_query    = null;
	$this->rows_affected = 0;
	$this->num_rows      = 0;
	$this->last_error    = '';

	if ( $this->result instanceof mysqli_result ) {
		mysqli_free_result( $this->result );
		$this->result = null;

		// Confidence check before using the handle.
		if ( empty( $this->dbh ) || ! ( $this->dbh instanceof mysqli ) ) {
			return;
		}

		// Clear out any results from a multi-query.
		while ( mysqli_more_results( $this->dbh ) ) {
			mysqli_next_result( $this->dbh );
		}
	}
}

Changelog

VersionDescription
0.71Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.