| 1 |
# 2014 June 17 |
| 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 FTS5 module. |
| 13 |
# |
| 14 |
# Specifically, it tests transactions and savepoints |
| 15 |
# |
| 16 |
|
| 17 |
source [file join [file dirname [info script]] fts5_common.tcl] |
| 18 |
set testprefix fts5ai |
| 19 |
|
| 20 |
# If SQLITE_ENABLE_FTS5 is not defined, omit this file. |
| 21 |
ifcapable !fts5 { |
| 22 |
finish_test |
| 23 |
return |
| 24 |
} |
| 25 |
|
| 26 |
foreach_detail_mode $testprefix { |
| 27 |
|
| 28 |
do_execsql_test 1.0 { |
| 29 |
CREATE VIRTUAL TABLE t1 USING fts5(a, detail=%DETAIL%); |
| 30 |
} {} |
| 31 |
|
| 32 |
do_execsql_test 1.1 { |
| 33 |
BEGIN; |
| 34 |
INSERT INTO t1 VALUES('a b c'); |
| 35 |
INSERT INTO t1 VALUES('d e f'); |
| 36 |
SAVEPOINT one; |
| 37 |
INSERT INTO t1 VALUES('g h i'); |
| 38 |
SAVEPOINT two; |
| 39 |
INSERT INTO t1 VALUES('j k l'); |
| 40 |
ROLLBACK TO one; |
| 41 |
INSERT INTO t1 VALUES('m n o'); |
| 42 |
SAVEPOINT two; |
| 43 |
INSERT INTO t1 VALUES('p q r'); |
| 44 |
RELEASE one; |
| 45 |
SAVEPOINT one; |
| 46 |
INSERT INTO t1 VALUES('s t u'); |
| 47 |
ROLLBACK TO one; |
| 48 |
COMMIT; |
| 49 |
} |
| 50 |
|
| 51 |
do_execsql_test 1.2 { |
| 52 |
INSERT INTO t1(t1) VALUES('integrity-check'); |
| 53 |
} |
| 54 |
|
| 55 |
do_execsql_test 1.3 { |
| 56 |
SAVEPOINT one; |
| 57 |
INSERT INTO t1 VALUES('v w x'); |
| 58 |
ROLLBACK TO one; |
| 59 |
} |
| 60 |
} |
| 61 |
|
| 62 |
|
| 63 |
finish_test |