Skip to content

Commit ff6bcaa

Browse files
committed
Test LOCK TABLES with a dot in the table name
Without quoting, SQLite read `main.t` as table `t` in the "main" schema, so locking a missing `main.t` table succeeded when `t` existed.
1 parent cf386e0 commit ff6bcaa

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10635,6 +10635,15 @@ public function testLockTablesWithQuotedIdentifiers(): void {
1063510635
$this->assertQuery( 'LOCK TABLES `missing table` READ' );
1063610636
}
1063710637

10638+
public function testLockTableWithDotInName(): void {
10639+
// "main.t" is a table name, not table "t" in the SQLite "main" schema.
10640+
$this->assertQuery( 'CREATE TABLE t (id INT)' );
10641+
10642+
$this->expectException( 'WP_MySQL_On_SQLite_Exception' );
10643+
$this->expectExceptionMessage( "Table 'wp.main.t' doesn't exist" );
10644+
$this->assertQuery( 'LOCK TABLES `main.t` READ' );
10645+
}
10646+
1063810647
public function testTransactionSavepoints(): void {
1063910648
$this->assertQuery( 'CREATE TABLE t (id INT)' );
1064010649

0 commit comments

Comments
 (0)