| | 674 | * @ticket 38751 |
| | 675 | */ |
| | 676 | function data_get_escaped_table_from_show_query() { |
| | 677 | $table = 'wp_123_foo'; |
| | 678 | $escaped_table = 'wp\_123\_foo'; |
| | 679 | |
| | 680 | $queries = array( |
| | 681 | "SHOW TABLES LIKE '$escaped_table'", |
| | 682 | "SHOW TABLES WHERE Name LIKE '$escaped_table'", |
| | 683 | |
| | 684 | "SHOW FULL TABLES LIKE '$escaped_table'", |
| | 685 | "SHOW FULL TABLES WHERE Name LIKE '$escaped_table'", |
| | 686 | |
| | 687 | "SHOW TABLE STATUS LIKE '$escaped_table'", |
| | 688 | "SHOW TABLE STATUS WHERE Name LIKE '$escaped_table'", |
| | 689 | ); |
| | 690 | |
| | 691 | $data = array(); |
| | 692 | |
| | 693 | foreach ( $queries as $query ) { |
| | 694 | $data[] = array( $query, $table ); |
| | 695 | |
| | 696 | // Test for double quotes, too. |
| | 697 | $data[] = array( str_replace( "'", '"', $query ), $table ); |
| | 698 | } |
| | 699 | |
| | 700 | return $data; |
| | 701 | } |
| | 702 | |
| | 703 | /** |
| | 704 | * @dataProvider data_get_escaped_table_from_show_query |
| | 705 | * @ticket 38751 |
| | 706 | */ |
| | 707 | function test_get_escaped_table_from_show_query( $query, $table ) { |
| | 708 | $this->assertEquals( $table, self::$_wpdb->get_table_from_query( $query ) ); |
| | 709 | } |
| | 710 | |
| | 711 | /** |