Changeset 33991
- Timestamp:
- 09/10/2015 06:54:13 AM (9 years ago)
- Location:
- branches/4.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.3/src/wp-includes/wp-db.php
r33455 r33991 2871 2871 . '|UPDATE(?:\s+LOW_PRIORITY)?(?:\s+IGNORE)?' 2872 2872 . '|DELETE(?:\s+LOW_PRIORITY|\s+QUICK|\s+IGNORE)*(?:\s+FROM)?' 2873 . ')\s+((?:[0-9a-zA-Z$_.` ]|[\xC2-\xDF][\x80-\xBF])+)/is', $query, $maybe ) ) {2873 . ')\s+((?:[0-9a-zA-Z$_.`-]|[\xC2-\xDF][\x80-\xBF])+)/is', $query, $maybe ) ) { 2874 2874 return str_replace( '`', '', $maybe[1] ); 2875 2875 } … … 2879 2879 . 'SHOW\s+TABLE\s+STATUS.+(?:LIKE\s+|WHERE\s+Name\s*=\s*)' 2880 2880 . '|SHOW\s+(?:FULL\s+)?TABLES.+(?:LIKE\s+|WHERE\s+Name\s*=\s*)' 2881 . ')\W((?:[0-9a-zA-Z$_.` ]|[\xC2-\xDF][\x80-\xBF])+)\W/is', $query, $maybe ) ) {2881 . ')\W((?:[0-9a-zA-Z$_.`-]|[\xC2-\xDF][\x80-\xBF])+)\W/is', $query, $maybe ) ) { 2882 2882 return str_replace( '`', '', $maybe[1] ); 2883 2883 } … … 2898 2898 . '|(?:GRANT|REVOKE).*ON\s+TABLE' 2899 2899 . '|SHOW\s+(?:.*FROM|.*TABLE)' 2900 . ')\s+\(*\s*((?:[0-9a-zA-Z$_.` ]|[\xC2-\xDF][\x80-\xBF])+)\s*\)*/is', $query, $maybe ) ) {2900 . ')\s+\(*\s*((?:[0-9a-zA-Z$_.`-]|[\xC2-\xDF][\x80-\xBF])+)\s*\)*/is', $query, $maybe ) ) { 2901 2901 return str_replace( '`', '', $maybe[1] ); 2902 2902 } -
branches/4.3/tests/phpunit/tests/db.php
r33259 r33991 527 527 function data_get_table_from_query() { 528 528 $table = 'a_test_table_name'; 529 $db_table = '`a_test_db`.`another_test_table`'; 529 $more_tables = array( 530 // table_name => expected_value 531 '`a_test_db`.`another_test_table`' => 'a_test_db.another_test_table', 532 'a-test-with-dashes' => 'a-test-with-dashes', 533 ); 530 534 531 535 $queries = array( … … 637 641 $querycount = count( $queries ); 638 642 for ( $ii = 0; $ii < $querycount; $ii++ ) { 639 $db_query = str_replace( $table, $db_table, $queries[ $ii ] ); 640 $expected_db_table = str_replace( '`', '', $db_table ); 643 foreach ( $more_tables as $name => $expected_name ) { 644 $new_query = str_replace( $table, $name, $queries[ $ii ] ); 645 $queries[] = array( $new_query, $expected_name ); 646 } 641 647 642 648 $queries[ $ii ] = array( $queries[ $ii ], $table ); 643 $queries[] = array( $db_query, $expected_db_table );644 649 } 645 650 return $queries;
Note: See TracChangeset
for help on using the changeset viewer.