xref: /sqlite-3.40.0/test/fts3drop.test (revision 341cadee)
1*341cadeeSdan# 2011 October 29
2*341cadeeSdan#
3*341cadeeSdan# The author disclaims copyright to this source code.  In place of
4*341cadeeSdan# a legal notice, here is a blessing:
5*341cadeeSdan#
6*341cadeeSdan#    May you do good and not evil.
7*341cadeeSdan#    May you find forgiveness for yourself and forgive others.
8*341cadeeSdan#    May you share freely, never taking more than you give.
9*341cadeeSdan#
10*341cadeeSdan#*************************************************************************
11*341cadeeSdan# This file implements regression tests for SQLite library.  The
12*341cadeeSdan# focus of this script is testing the FTS3 module. More specifically,
13*341cadeeSdan# that DROP TABLE commands can co-exist with savepoints inside transactions.
14*341cadeeSdan# See ticket [48f299634a] for details.
15*341cadeeSdan#
16*341cadeeSdan
17*341cadeeSdan
18*341cadeeSdanset testdir [file dirname $argv0]
19*341cadeeSdansource $testdir/tester.tcl
20*341cadeeSdanset testprefix fts3drop
21*341cadeeSdan
22*341cadeeSdan# If SQLITE_ENABLE_FTS3 is defined, omit this file.
23*341cadeeSdanifcapable !fts3 {
24*341cadeeSdan  finish_test
25*341cadeeSdan  return
26*341cadeeSdan}
27*341cadeeSdan
28*341cadeeSdando_execsql_test 1.1 {
29*341cadeeSdan  CREATE VIRTUAL TABLE f1 USING fts3;
30*341cadeeSdan  INSERT INTO f1 VALUES('a b c');
31*341cadeeSdan}
32*341cadeeSdan
33*341cadeeSdando_execsql_test 1.2 {
34*341cadeeSdan  BEGIN;
35*341cadeeSdan    INSERT INTO f1 VALUES('d e f');
36*341cadeeSdan    SAVEPOINT one;
37*341cadeeSdan      INSERT INTO f1 VALUES('g h i');
38*341cadeeSdan      DROP TABLE f1;
39*341cadeeSdan    ROLLBACK TO one;
40*341cadeeSdan  COMMIT;
41*341cadeeSdan}
42*341cadeeSdan
43*341cadeeSdando_execsql_test 1.3 {
44*341cadeeSdan  SELECT * FROM f1;
45*341cadeeSdan} {{a b c} {d e f}}
46*341cadeeSdan
47*341cadeeSdando_execsql_test 1.4 {
48*341cadeeSdan  BEGIN;
49*341cadeeSdan    INSERT INTO f1 VALUES('g h i');
50*341cadeeSdan    SAVEPOINT one;
51*341cadeeSdan      INSERT INTO f1 VALUES('j k l');
52*341cadeeSdan      DROP TABLE f1;
53*341cadeeSdan    RELEASE one;
54*341cadeeSdan  ROLLBACK;
55*341cadeeSdan}
56*341cadeeSdan
57*341cadeeSdando_execsql_test 1.5 {
58*341cadeeSdan  SELECT * FROM f1;
59*341cadeeSdan} {{a b c} {d e f}}
60*341cadeeSdan
61*341cadeeSdanfinish_test
62