sl@0
|
1 |
# 2006 August 29
|
sl@0
|
2 |
#
|
sl@0
|
3 |
# The author disclaims copyright to this source code. In place of
|
sl@0
|
4 |
# a legal notice, here is a blessing:
|
sl@0
|
5 |
#
|
sl@0
|
6 |
# May you do good and not evil.
|
sl@0
|
7 |
# May you find forgiveness for yourself and forgive others.
|
sl@0
|
8 |
# May you share freely, never taking more than you give.
|
sl@0
|
9 |
#
|
sl@0
|
10 |
#***********************************************************************
|
sl@0
|
11 |
# This file implements regression tests for SQLite library. The
|
sl@0
|
12 |
# focus of this file inserting into virtual tables from a SELECT
|
sl@0
|
13 |
# statement.
|
sl@0
|
14 |
#
|
sl@0
|
15 |
# $Id: vtab8.test,v 1.2 2007/03/02 08:12:23 danielk1977 Exp $
|
sl@0
|
16 |
|
sl@0
|
17 |
set testdir [file dirname $argv0]
|
sl@0
|
18 |
source $testdir/tester.tcl
|
sl@0
|
19 |
|
sl@0
|
20 |
ifcapable !vtab {
|
sl@0
|
21 |
finish_test
|
sl@0
|
22 |
return
|
sl@0
|
23 |
}
|
sl@0
|
24 |
|
sl@0
|
25 |
register_echo_module [sqlite3_connection_pointer db]
|
sl@0
|
26 |
|
sl@0
|
27 |
# See ticket #2244
|
sl@0
|
28 |
#
|
sl@0
|
29 |
do_test vtab1.2244-1 {
|
sl@0
|
30 |
execsql {
|
sl@0
|
31 |
CREATE TABLE t2244(a, b);
|
sl@0
|
32 |
CREATE VIRTUAL TABLE t2244e USING echo(t2244);
|
sl@0
|
33 |
INSERT INTO t2244 VALUES('AA', 'BB');
|
sl@0
|
34 |
INSERT INTO t2244 VALUES('CC', 'DD');
|
sl@0
|
35 |
SELECT rowid, * FROM t2244e;
|
sl@0
|
36 |
}
|
sl@0
|
37 |
} {1 AA BB 2 CC DD}
|
sl@0
|
38 |
do_test vtab1.2244-2 {
|
sl@0
|
39 |
execsql {
|
sl@0
|
40 |
SELECT * FROM t2244e WHERE rowid = 10;
|
sl@0
|
41 |
}
|
sl@0
|
42 |
} {}
|
sl@0
|
43 |
do_test vtab1.2244-3 {
|
sl@0
|
44 |
execsql {
|
sl@0
|
45 |
UPDATE t2244e SET a = 'hello world' WHERE 0;
|
sl@0
|
46 |
SELECT rowid, * FROM t2244e;
|
sl@0
|
47 |
}
|
sl@0
|
48 |
} {1 AA BB 2 CC DD}
|
sl@0
|
49 |
|
sl@0
|
50 |
do_test vtab1-2250-2 {
|
sl@0
|
51 |
execsql {
|
sl@0
|
52 |
CREATE TABLE t2250(a, b);
|
sl@0
|
53 |
INSERT INTO t2250 VALUES(10, 20);
|
sl@0
|
54 |
CREATE VIRTUAL TABLE t2250e USING echo(t2250);
|
sl@0
|
55 |
select max(rowid) from t2250;
|
sl@0
|
56 |
select max(rowid) from t2250e;
|
sl@0
|
57 |
}
|
sl@0
|
58 |
} {1 1}
|
sl@0
|
59 |
|
sl@0
|
60 |
# See ticket #2260.
|
sl@0
|
61 |
#
|
sl@0
|
62 |
do_test vtab1.2260-1 {
|
sl@0
|
63 |
execsql {
|
sl@0
|
64 |
CREATE TABLE t2260a_real(a, b);
|
sl@0
|
65 |
CREATE TABLE t2260b_real(a, b);
|
sl@0
|
66 |
|
sl@0
|
67 |
CREATE INDEX i2260 ON t2260a_real(a);
|
sl@0
|
68 |
CREATE INDEX i2260x ON t2260b_real(a);
|
sl@0
|
69 |
|
sl@0
|
70 |
CREATE VIRTUAL TABLE t2260a USING echo(t2260a_real);
|
sl@0
|
71 |
CREATE VIRTUAL TABLE t2260b USING echo(t2260b_real);
|
sl@0
|
72 |
|
sl@0
|
73 |
SELECT * FROM t2260a, t2260b WHERE t2260a.a = t2260b.a AND t2260a.a > 101;
|
sl@0
|
74 |
}
|
sl@0
|
75 |
} {}
|
sl@0
|
76 |
|
sl@0
|
77 |
unset -nocomplain echo_module_begin_fail
|
sl@0
|
78 |
finish_test
|