mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 07:40:07 +00:00
WPDB: Allow queries to reference tables in the dbname.tablename format, and allow table names to contain any valid character, rather than just ASCII.
Props pento, willstedt for the initial patch. See #32090. git-svn-id: https://develop.svn.wordpress.org/trunk@32368 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -526,6 +526,7 @@ class Tests_DB extends WP_UnitTestCase {
|
||||
*/
|
||||
function data_get_table_from_query() {
|
||||
$table = 'a_test_table_name';
|
||||
$db_table = '`a_test_db`.`another_test_table`';
|
||||
|
||||
$queries = array(
|
||||
// Basic
|
||||
@@ -628,8 +629,13 @@ class Tests_DB extends WP_UnitTestCase {
|
||||
"SHOW INDEX FROM $table",
|
||||
);
|
||||
|
||||
foreach ( $queries as &$query ) {
|
||||
$query = array( $query, $table );
|
||||
$querycount = count( $queries );
|
||||
for ( $ii = 0; $ii < $querycount; $ii++ ) {
|
||||
$db_query = str_replace( $table, $db_table, $queries[ $ii ] );
|
||||
$expected_db_table = str_replace( '`', '', $db_table );
|
||||
|
||||
$queries[ $ii ] = array( $queries[ $ii ], $table );
|
||||
$queries[] = array( $db_query, $expected_db_table );
|
||||
}
|
||||
return $queries;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user