xref: /sqlite-3.40.0/test/fts3drop.test (revision 341cadee)
1# 2011 October 29
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# This file implements regression tests for SQLite library.  The
12# focus of this script is testing the FTS3 module. More specifically,
13# that DROP TABLE commands can co-exist with savepoints inside transactions.
14# See ticket [48f299634a] for details.
15#
16
17
18set testdir [file dirname $argv0]
19source $testdir/tester.tcl
20set testprefix fts3drop
21
22# If SQLITE_ENABLE_FTS3 is defined, omit this file.
23ifcapable !fts3 {
24  finish_test
25  return
26}
27
28do_execsql_test 1.1 {
29  CREATE VIRTUAL TABLE f1 USING fts3;
30  INSERT INTO f1 VALUES('a b c');
31}
32
33do_execsql_test 1.2 {
34  BEGIN;
35    INSERT INTO f1 VALUES('d e f');
36    SAVEPOINT one;
37      INSERT INTO f1 VALUES('g h i');
38      DROP TABLE f1;
39    ROLLBACK TO one;
40  COMMIT;
41}
42
43do_execsql_test 1.3 {
44  SELECT * FROM f1;
45} {{a b c} {d e f}}
46
47do_execsql_test 1.4 {
48  BEGIN;
49    INSERT INTO f1 VALUES('g h i');
50    SAVEPOINT one;
51      INSERT INTO f1 VALUES('j k l');
52      DROP TABLE f1;
53    RELEASE one;
54  ROLLBACK;
55}
56
57do_execsql_test 1.5 {
58  SELECT * FROM f1;
59} {{a b c} {d e f}}
60
61finish_test
62