Enhance the command-line completion extension to return the names of
[sqlite.git] / test / fts4lastrowid.test
blob7b35e3c53bb9a0a6d46b7065e649d12d68ebfb94
1 # 2017 Feb 27
3 # The author disclaims copyright to this source code.  In place of
4 # a legal notice, here is a blessing:
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.
10 #***********************************************************************
12 # Tests of the last_insert_rowid functionality with fts4.
15 set testdir [file dirname $argv0]
16 source [file join [file dirname [info script]] tester.tcl]
17 set testprefix fts4lastrowid
19 ifcapable !fts3 {
20   finish_test
21   return
24 do_execsql_test 1.0 {
25   CREATE VIRTUAL TABLE t1 USING fts4(str);
28 do_execsql_test 1.1 {
29   INSERT INTO t1 VALUES('one string');
30   INSERT INTO t1 VALUES('two string');
31   INSERT INTO t1 VALUES('three string');
32   SELECT last_insert_rowid();
33 } {3}
35 do_execsql_test 1.2 {
36   BEGIN;
37     INSERT INTO t1 VALUES('one string');
38     INSERT INTO t1 VALUES('two string');
39     INSERT INTO t1 VALUES('three string');
40   COMMIT;
41   SELECT last_insert_rowid();
42 } {6}
44 do_execsql_test 1.3 {
45   INSERT INTO t1(rowid, str) VALUES(-22, 'some more text');
46   SELECT last_insert_rowid();
47 } {-22}
49 do_execsql_test 1.4 {
50   BEGIN;
51     INSERT INTO t1(rowid, str) VALUES(45, 'some more text');
52     INSERT INTO t1(rowid, str) VALUES(46, 'some more text');
53     INSERT INTO t1(rowid, str) VALUES(222, 'some more text');
54     SELECT last_insert_rowid();
55   COMMIT;
56   SELECT last_insert_rowid();
57 } {222 222}
59 do_execsql_test 1.5 {
60   CREATE TABLE x1(x);
61   INSERT INTO x1 VALUES('john'), ('paul'), ('george'), ('ringo');
62   INSERT INTO t1 SELECT x FROM x1;
63   SELECT last_insert_rowid();
64 } {226}
66 do_execsql_test 1.6 {
67   INSERT INTO t1(rowid, str) SELECT rowid+10, x FROM x1;
68   SELECT last_insert_rowid();
69 } {14}
72 finish_test