Skip to content

Commit 947fa97

Browse files
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: https://core.svn.wordpress.org/trunk@59958 1a063a9b-81f0-0310-95a4-ce76da25c4cd
1 parent 8deb870 commit 947fa97

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

wp-includes/class-wpdb.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3803,6 +3803,9 @@ protected function get_table_from_query( $query ) {
38033803
// Strip everything between parentheses except nested selects.
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(
38083811
'/^\s*(?:'

wp-includes/version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* @global string $wp_version
1818
*/
19-
$wp_version = '6.9-alpha-60621';
19+
$wp_version = '6.9-alpha-60622';
2020

2121
/**
2222
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

0 commit comments

Comments
 (0)