Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/sqlite/blob/master/ext/fts5/test/fts5savepoint.test # sqlite [Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `sqlite / ext / fts5 / test / fts5savepoint.test` 123 lines ยท 2878 bytes Raw Blame History 1 # 2019 Dec 26 2 # 3 # The author disclaims copyright to this source code. In place of 4 # a legal notice, here is a blessing: 5 # 6 # May you do good and not evil. 7 # May you find forgiveness for yourself and forgive others. 8 # May you share freely, never taking more than you give. 9 # 10 #*********************************************************************** 11 # 12 13 source [file join [file dirname [info script]] fts5_common.tcl] 14 set testprefix fts5savepoint 15 16 # If SQLITE_ENABLE_FTS5 is not defined, omit this file. 17 ifcapable !fts5 { 18 finish_test 19 return 20 } 21 22 do_execsql_test 1.0 { 23 CREATE VIRTUAL TABLE ft USING fts5(c); 24 BEGIN; 25 SAVEPOINT one; 26 INSERT INTO ft VALUES('a'); 27 SAVEPOINT two; 28 INSERT INTO ft VALUES('b'); 29 RELEASE two; 30 SAVEPOINT four; 31 INSERT INTO ft VALUES('c'); 32 RELEASE four; 33 SAVEPOINT three; 34 INSERT INTO ft VALUES('d'); 35 ROLLBACK TO three; 36 COMMIT; 37 SELECT * FROM ft 38 } {a b c} 39 40 reset_db 41 do_catchsql_test 2.0 { 42 CREATE VIRTUAL TABLE ft1 USING fts5(c); 43 CREATE VIRTUAL TABLE ft2 USING fts5(c); 44 DROP TABLE ft2_idx; 45 BEGIN; 46 INSERT INTO ft2 VALUES('a'); 47 INSERT INTO ft1 VALUES('a'); 48 SAVEPOINT two; 49 INSERT INTO ft1 VALUES('b'); 50 COMMIT; 51 } {1 {database disk image is malformed}} 52 53 reset_db 54 ifcapable fts3 { 55 do_execsql_test 3.0 { 56 CREATE VIRTUAL TABLE vt0 USING fts5(c0); 57 CREATE VIRTUAL TABLE vt1 USING fts4(c0); 58 INSERT INTO vt1(c0) VALUES(0); 59 } 60 61 do_execsql_test 3.1 { 62 BEGIN; 63 UPDATE vt1 SET c0 = 0; 64 INSERT INTO vt1(c0) VALUES (0), (0); 65 UPDATE vt0 SET c0 = 0; 66 INSERT INTO vt1(c0) VALUES (0); 67 UPDATE vt1 SET c0 = 0; 68 INSERT INTO vt1(vt1) VALUES('automerge=1'); 69 UPDATE vt1 SET c0 = 0; 70 } 71 72 do_catchsql_test 3.2 { 73 DROP TABLE vt1; 74 } {0 {}} 75 76 do_execsql_test 3.3 { 77 SAVEPOINT x; 78 INSERT INTO vt0 VALUES('x'); 79 COMMIT; 80 INSERT INTO vt0(vt0) VALUES('integrity-check'); 81 } 82 } 83 84 # Bug 2026-10-20T20:37:14Z 85 reset_db 86 do_execsql_test 4.0 { 87 CREATE TABLE t1(a); 88 BEGIN; 89 INSERT INTO t1 VALUES (1); 90 SAVEPOINT s0; 91 CREATE VIRTUAL TABLE t2 USING fts5(x); 92 INSERT INTO t2 VALUES ('apple'); 93 ROLLBACK TO s0; 94 SAVEPOINT s1; 95 COMMIT; 96 SELECT count(*) FROM t1; 97 } 1 98 99 # Forum post `bc159f8204`. ROLLBACK while a MATCH query is active. 100 reset_db 101 do_execsql_test 5.0 { 102 CREATE VIRTUAL TABLE ft USING fts5(c); 103 INSERT INTO ft VALUES('a'); 104 INSERT INTO ft VALUES('a'); 105 BEGIN; 106 INSERT INTO ft VALUES('b'); 107 } 108 do_test 5.1 { 109 set ::stmt [sqlite3_prepare_v2 db {SELECT rowid FROM ft('a')} -1 dummy] 110 list [sqlite3_step $::stmt] [sqlite3_column_int $::stmt 0] 111 } {SQLITE_ROW 1} 112 do_test 5.2 { 113 db eval ROLLBACK 114 list [sqlite3_step $::stmt] [sqlite3_column_int $::stmt 0] 115 } {SQLITE_ROW 2} 116 do_test 5.3 { 117 sqlite3_step $::stmt 118 } {SQLITE_DONE} 119 do_test 5.4 { 120 sqlite3_finalize $::stmt 121 } {SQLITE_OK} 122 123 finish_test