Skip to content

Commit 02adb2a

Browse files
committed
Preserve unsupported SQL mode validation
Retain trunk's rejection of NO_BACKSLASH_ESCAPES after moving SQL modes to a bitmap, including numeric assignments.
1 parent e3d36a6 commit 02adb2a

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

‎packages/mysql-on-sqlite/src/sqlite/class-wp-mysql-on-sqlite.php‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5923,6 +5923,10 @@ private function set_sql_modes( $modes ): void {
59235923
);
59245924
}
59255925

5926+
if ( ( $sql_modes & self::SQL_MODES['NO_BACKSLASH_ESCAPES'] ) !== 0 ) {
5927+
throw $this->new_not_supported_exception( "SQL mode 'NO_BACKSLASH_ESCAPES'" );
5928+
}
5929+
59265930
/*
59275931
* MySQL retains composite SQL modes while enabling their component modes.
59285932
* Store both so "@@sql_mode" and individual mode checks match MySQL, even

‎packages/mysql-on-sqlite/tests/WP_MySQL_On_SQLite_Tests.php‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class WP_MySQL_On_SQLite_Tests extends TestCase {
1212
private const SQL_MODE_NOT_USED = 1 << 4;
1313
private const SQL_MODE_POSTGRESQL = 1 << 8;
1414
private const SQL_MODE_ORACLE = 1 << 9;
15+
private const SQL_MODE_NO_BACKSLASH_ESCAPES = 1 << 20;
1516
private const SQL_MODE_TIME_TRUNCATE_FRACTIONAL = 1 << 32;
1617
private const UNKNOWN_SQL_MODE_BIT = 1 << 33;
1718

@@ -6219,6 +6220,7 @@ public function testNoBackslashEscapesSqlModeIsNotSupported(): void {
62196220
"SET sql_mode = 'STRICT_TRANS_TABLES,NO_BACKSLASH_ESCAPES'",
62206221
"SET sql_mode = 'STRICT_TRANS_TABLES,NO_BACKSLASH_ESCAPES '",
62216222
"SET sql_mode = 'no_backslash_escapes'",
6223+
'SET sql_mode = ' . self::SQL_MODE_NO_BACKSLASH_ESCAPES,
62226224
);
62236225

62246226
foreach ( $queries as $query ) {

0 commit comments

Comments
 (0)