Add failing test for "DROP TABLE t" executed from a prepared statement.

This commit is contained in:
Gwendal Roué committed 2017-10-05 13:55:51 +02:00
1 parent 1578dfe26b
commit fc88acc782
1 file changed
+16
@@ -307,4 +307,20 @@ class UpdateStatementTests : GRDBTestCase {
}
}
}
func testDropTablePreparedStatement() throws {
// In v2.0.1...
let dbQueue = try makeDatabaseQueue()
try dbQueue.inDatabase { db in
XCTAssertFalse(try db.tableExists("t"))
try db.execute("CREATE TABLE t(a)")
XCTAssertTrue(try db.tableExists("t"))
try db.execute("DROP TABLE t") // ... this would drop the table
XCTAssertFalse(try db.tableExists("t"))
try db.execute("CREATE TABLE t(a)")
XCTAssertTrue(try db.tableExists("t"))
try db.makeUpdateStatement("DROP TABLE t").execute() // ... but this would not. WTF??? Hence this regression test.
XCTAssertFalse(try db.tableExists("t"))
}
}
}