wpdb::flush()

Kill cached query results.


Description Description


Source Source

File: wp-includes/wp-db.php

1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
public function flush() {
    $this->last_result   = array();
    $this->col_info      = null;
    $this->last_query    = null;
    $this->rows_affected = $this->num_rows = 0;
    $this->last_error    = '';
 
    if ( $this->use_mysqli && $this->result instanceof mysqli_result ) {
        mysqli_free_result( $this->result );
        $this->result = null;
 
        // Sanity 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 );
        }
    } elseif ( is_resource( $this->result ) ) {
        mysql_free_result( $this->result );
    }
}

Top ↑

Changelog Changelog

Changelog
Version Description
0.71 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

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