Make WordPress Core


Ignore:
Timestamp:
08/10/2025 08:58:31 PM (10 months ago)
Author:
SergeyBiryukov
Message:

Database: Add support for SET STATEMENT in wpdb::get_table_from_query().

MariaDB supports setting various parameters for queries. This commit ensures that wpdb can properly retrieve the table name from such queries.

Reference: MariaDB Documentation: SET STATEMENT.

Follow-up to [30345].

Props dd32.
Fixes #63777.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wpdb.php

    r60363 r60622  
    38043804        $query = preg_replace( '/\((?!\s*select)[^(]*?\)/is', '()', $query );
    38053805
     3806        // Strip any leading SET STATEMENT statements.
     3807        $query = preg_replace( '/^SET STATEMENT.+?\sFOR\s+/is', '', $query );
     3808
    38063809        // Quickly match most common queries.
    38073810        if ( preg_match(
Note: See TracChangeset for help on using the changeset viewer.