Skip to content

Commit

Permalink
Handle case insensitivity and whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
akirk committed Jul 24, 2024
1 parent 7873c8b commit 95499b2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions tests/WP_SQLite_Query_Tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ public function testOnDuplicateKeyWithUnnamedKeys() {

public function testOnCreateTableIfNotExistsWithIndexAdded() {
$this->assertQuery(
'CREATE TABLE IF NOT EXISTS `test` (
'CREATE TABLE IF not EXISTS `test` (
`id` INT,
`name` VARCHAR(255),
`other` VARCHAR(255),
Expand All @@ -548,7 +548,7 @@ public function testOnCreateTableIfNotExistsWithIndexAdded() {
);'
);
$this->assertQuery(
'CREATE TABLE IF NOT EXISTS `test` (
'CREATE TABLE if NOT ExisTS `test` (
`id` INT,
`name` VARCHAR(255),
`other` VARCHAR(255),
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/sqlite/class-wp-sqlite-translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,7 @@ private function execute_create_table() {
')'
);

$if_not_exists = false === strpos( $create_query, 'IF NOT EXISTS' ) ? '' : 'IF NOT EXISTS';
$if_not_exists = preg_match( '/\bIF\s+NOT\s+EXISTS\b/i', $create_query ) ? 'IF NOT EXISTS' : '';

$this->execute_sqlite_query( $create_query );
$this->results = $this->last_exec_returned;
Expand Down

0 comments on commit 95499b2

Please sign in to comment.