Index: third_party/sqlite/src/test/fts3ao.test |
diff --git a/third_party/sqlite/src/test/fts3ao.test b/third_party/sqlite/src/test/fts3ao.test |
index c3d356e8fde76c59713d710ac2e0e10718194877..cd9df01eb44cd7309ebc2b015d6a99d8ad56a408 100644 |
--- a/third_party/sqlite/src/test/fts3ao.test |
+++ b/third_party/sqlite/src/test/fts3ao.test |
@@ -23,6 +23,8 @@ ifcapable !fts3 { |
return |
} |
+set ::testprefix fts3ao |
+ |
#--------------------------------------------------------------------- |
# These tests, fts3ao-1.*, test that ticket #2429 is fixed. |
# |
@@ -166,4 +168,53 @@ do_test fts3ao-3.3 { |
execsql { SELECT a, b, c FROM t1 WHERE c MATCH 'two'; } |
} {{one three four} {one four} {one two}} |
+#--------------------------------------------------------------------- |
+# Test that it is possible to rename an fts3 table within a |
+# transaction. |
+# |
+do_test fts3ao-4.1 { |
+ execsql { |
+ CREATE VIRTUAL TABLE t4 USING fts3; |
+ INSERT INTO t4 VALUES('the quick brown fox'); |
+ } |
+} {} |
+do_test fts3ao-4.2 { |
+ execsql { |
+ BEGIN; |
+ INSERT INTO t4 VALUES('jumped over the'); |
+ } |
+} {} |
+do_test fts3ao-4.3 { execsql { ALTER TABLE t4 RENAME TO t5; } } {} |
+do_test fts3ao-4.4 { execsql { INSERT INTO t5 VALUES('lazy dog'); } } {} |
+do_test fts3ao-4.5 { execsql COMMIT } {} |
+do_test fts3ao-4.6 { |
+ execsql { SELECT * FROM t5 } |
+} {{the quick brown fox} {jumped over the} {lazy dog}} |
+do_test fts3ao-4.7 { |
+ execsql { |
+ BEGIN; |
+ INSERT INTO t5 VALUES('Down came a jumbuck to drink at that billabong'); |
+ ALTER TABLE t5 RENAME TO t6; |
+ INSERT INTO t6 VALUES('Down came the troopers, one, two, three'); |
+ ROLLBACK; |
+ SELECT * FROM t5; |
+ } |
+} {{the quick brown fox} {jumped over the} {lazy dog}} |
+ |
+# Test that it is possible to rename an FTS4 table. Renaming an FTS4 table |
+# involves renaming the extra %_docsize and %_stat tables. |
+# |
+do_execsql_test 5.1 { |
+ CREATE VIRTUAL TABLE t7 USING FTS4; |
+ INSERT INTO t7 VALUES('coined by a German clinician'); |
+ SELECT count(*) FROM sqlite_master WHERE name LIKE 't7%'; |
+ SELECT count(*) FROM sqlite_master WHERE name LIKE 't8%'; |
+} {6 0} |
+do_execsql_test 5.2 { |
+ ALTER TABLE t7 RENAME TO t8; |
+ SELECT count(*) FROM sqlite_master WHERE name LIKE 't7%'; |
+ SELECT count(*) FROM sqlite_master WHERE name LIKE 't8%'; |
+} {0 6} |
+ |
finish_test |
+ |