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: [https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/set-commands/set-statement MariaDB Documentation: SET STATEMENT]. Follow-up to [30345]. Props dd32. Fixes #63777. Built from https://develop.svn.wordpress.org/trunk@60622 git-svn-id: http://core.svn.wordpress.org/trunk@59958 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -3803,6 +3803,9 @@ class wpdb {
|
||||
// Strip everything between parentheses except nested selects.
|
||||
$query = preg_replace( '/\((?!\s*select)[^(]*?\)/is', '()', $query );
|
||||
|
||||
// Strip any leading SET STATEMENT statements.
|
||||
$query = preg_replace( '/^SET STATEMENT.+?\sFOR\s+/is', '', $query );
|
||||
|
||||
// Quickly match most common queries.
|
||||
if ( preg_match(
|
||||
'/^\s*(?:'
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.9-alpha-60621';
|
||||
$wp_version = '6.9-alpha-60622';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
||||
Reference in New Issue
Block a user