Changeset 30297
- Timestamp:
- 11/10/2014 05:39:50 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/wp-db.php
r30292 r30297 1323 1323 $this->last_error = ''; 1324 1324 1325 if ( is_resource( $this->result ) ) { 1326 if ( $this->use_mysqli ) { 1327 mysqli_free_result( $this->result ); 1328 } else { 1329 mysql_free_result( $this->result ); 1330 } 1325 if ( $this->use_mysqli && $this->result instanceof mysqli_result ) { 1326 mysqli_free_result( $this->result ); 1327 $this->result = null; 1328 1329 // Clear out any results from a multi-query 1330 while ( mysqli_more_results( $this->dbh ) ) { 1331 mysqli_next_result( $this->dbh ); 1332 } 1333 } else if ( is_resource( $this->result ) ) { 1334 mysql_free_result( $this->result ); 1331 1335 } 1332 1336 } -
trunk/tests/phpunit/tests/db.php
r29701 r30297 459 459 $wpdb->suppress_errors( $suppress ); 460 460 } 461 462 /** 463 * mysqli_ incorrect flush and further sync issues. 464 * 465 * @ticket 28155 466 */ 467 function test_mysqli_flush_sync() { 468 global $wpdb; 469 if ( ! $wpdb->use_mysqli ) { 470 $this->markTestSkipped( 'mysqli not being used' ); 471 } 472 473 $suppress = $wpdb->suppress_errors( true ); 474 475 $wpdb->query( 'DROP PROCEDURE IF EXISTS `test_mysqli_flush_sync_procedure`' ); 476 $wpdb->query( 'CREATE PROCEDURE `test_mysqli_flush_sync_procedure`() BEGIN 477 SELECT ID FROM `' . $wpdb->posts . '` LIMIT 1; 478 END' ); 479 480 if ( count( $wpdb->get_results( 'SHOW CREATE PROCEDURE `test_mysqli_flush_sync_procedure`' ) ) < 1 ) { 481 $wpdb->suppress_errors( $suppress ); 482 $this->markTestSkipped( 'procedure could not be created (missing privileges?)' ); 483 } 484 485 $this->factory->post->create(); 486 487 $this->assertNotEmpty( $wpdb->get_results( 'CALL `test_mysqli_flush_sync_procedure`' ) ); 488 $this->assertNotEmpty( $wpdb->get_results( "SELECT ID FROM `{$wpdb->posts}` LIMIT 1" ) ); 489 490 $wpdb->query( 'DROP PROCEDURE IF EXISTS `test_mysqli_flush_sync_procedure`' ); 491 $wpdb->suppress_errors( $suppress ); 492 } 461 493 }
Note: See TracChangeset
for help on using the changeset viewer.