Skip to content

Commit 93332f2

Browse files
committed
test
1 parent 59e37ab commit 93332f2

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

wp-includes/sqlite-ast/class-wp-pdo-mysql-on-sqlite.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5792,7 +5792,13 @@ function ( $column ) {
57925792
$this->quote_sqlite_identifier( $new_table_name ?? $table_name )
57935793
);
57945794
$create_table_query .= implode( ",\n", $rows );
5795-
$create_table_query .= "\n) STRICT";
5795+
$create_table_query .= "\n)";
5796+
5797+
$bypass_strict = defined( 'WP_SQLITE_UNSAFE_ENABLE_UNSUPPORTED_VERSIONS' ) && WP_SQLITE_UNSAFE_ENABLE_UNSUPPORTED_VERSIONS;
5798+
if ( ! $bypass_strict ) {
5799+
$create_table_query .= ' STRICT';
5800+
}
5801+
57965802
return array_merge( array( $create_table_query ), $create_index_queries, $on_update_queries );
57975803
}
57985804

wp-includes/sqlite-ast/class-wp-sqlite-information-schema-builder.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,10 +392,12 @@ public function temporary_table_exists( string $table_name ): bool {
392392
* database. Tables that are missing will be created.
393393
*/
394394
public function ensure_information_schema_tables(): void {
395+
$bypass_strict = defined( 'WP_SQLITE_UNSAFE_ENABLE_UNSUPPORTED_VERSIONS' ) && WP_SQLITE_UNSAFE_ENABLE_UNSUPPORTED_VERSIONS;
395396
foreach ( self::INFORMATION_SCHEMA_TABLE_DEFINITIONS as $table_name => $table_body ) {
396397
$this->connection->query(
397398
sprintf(
398-
'CREATE TABLE IF NOT EXISTS %s%s (%s) STRICT',
399+
'CREATE TABLE IF NOT EXISTS %s%s (%s)%s',
400+
$bypass_strict ? '' : ' STRICT',
399401
$this->table_prefix,
400402
$table_name,
401403
$table_body
@@ -457,6 +459,7 @@ public function get_computed_information_schema_table_definition( string $table_
457459
* the SQLite database. Tables that are missing will be created.
458460
*/
459461
public function ensure_temporary_information_schema_tables(): void {
462+
$bypass_strict = defined( 'WP_SQLITE_UNSAFE_ENABLE_UNSUPPORTED_VERSIONS' ) && WP_SQLITE_UNSAFE_ENABLE_UNSUPPORTED_VERSIONS;
460463
foreach ( self::INFORMATION_SCHEMA_TABLE_DEFINITIONS as $table_name => $table_body ) {
461464
// Skip the "schemata" table; MySQL doesn't support temporary databases.
462465
if ( 'schemata' === $table_name ) {
@@ -465,7 +468,8 @@ public function ensure_temporary_information_schema_tables(): void {
465468

466469
$this->connection->query(
467470
sprintf(
468-
'CREATE TEMPORARY TABLE IF NOT EXISTS %s%s (%s) STRICT',
471+
'CREATE TEMPORARY TABLE IF NOT EXISTS %s%s (%s)%s',
472+
$bypass_strict ? '' : ' STRICT',
469473
$this->temporary_table_prefix,
470474
$table_name,
471475
$table_body

0 commit comments

Comments
 (0)