Make WordPress Core


Ignore:
Timestamp:
05/06/2015 09:04:46 PM (9 years ago)
Author:
johnbillion
Message:

WPDB: Allow queries to reference tables in the dbname.tablename format, and allow table names to contain any valid character, rather than just ASCII.

Merge of [32368] to the 3.9 branch.

Props pento, willstedt for the initial patch.

See #32090.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.9/tests/phpunit/tests/db.php

    r32389 r32414  
    393393    function data_get_table_from_query() {
    394394        $table = 'a_test_table_name';
     395        $db_table = '`a_test_db`.`another_test_table`';
    395396
    396397        $queries = array(
     
    495496        );
    496497
    497         foreach ( $queries as &$query ) {
    498             $query = array( $query, $table );
     498        $querycount = count( $queries );
     499        for ( $ii = 0; $ii < $querycount; $ii++ ) {
     500            $db_query = str_replace( $table, $db_table, $queries[ $ii ] );
     501            $expected_db_table = str_replace( '`', '', $db_table );
     502
     503            $queries[ $ii ] = array( $queries[ $ii ], $table );
     504            $queries[] = array( $db_query, $expected_db_table );
    499505        }
    500506        return $queries;
Note: See TracChangeset for help on using the changeset viewer.