wpdb::flush()
was not flushing results correctly when using mysqli.
This change also allows stored procedures or queries made with `mysqli_multi_query()` to be flushed. Includes unit tests. Fixes #28155. Props soulseekah. Built from https://develop.svn.wordpress.org/trunk@30297 git-svn-id: http://core.svn.wordpress.org/trunk@30296 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5f27bdc78d
commit
0013150649
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.1-alpha-30296';
|
$wp_version = '4.1-alpha-30297';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
@ -1322,12 +1322,16 @@ class wpdb {
|
|||||||
$this->rows_affected = $this->num_rows = 0;
|
$this->rows_affected = $this->num_rows = 0;
|
||||||
$this->last_error = '';
|
$this->last_error = '';
|
||||||
|
|
||||||
if ( is_resource( $this->result ) ) {
|
if ( $this->use_mysqli && $this->result instanceof mysqli_result ) {
|
||||||
if ( $this->use_mysqli ) {
|
|
||||||
mysqli_free_result( $this->result );
|
mysqli_free_result( $this->result );
|
||||||
} else {
|
$this->result = null;
|
||||||
mysql_free_result( $this->result );
|
|
||||||
|
// Clear out any results from a multi-query
|
||||||
|
while ( mysqli_more_results( $this->dbh ) ) {
|
||||||
|
mysqli_next_result( $this->dbh );
|
||||||
}
|
}
|
||||||
|
} else if ( is_resource( $this->result ) ) {
|
||||||
|
mysql_free_result( $this->result );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user