sl@0
|
1 |
# 2007 April 16
|
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 tests interactions between the virtual table and
|
sl@0
|
12 |
# shared-schema functionality.
|
sl@0
|
13 |
#
|
sl@0
|
14 |
# $Id: vtab_shared.test,v 1.2 2008/03/19 13:03:34 drh Exp $
|
sl@0
|
15 |
|
sl@0
|
16 |
set testdir [file dirname $argv0]
|
sl@0
|
17 |
source $testdir/tester.tcl
|
sl@0
|
18 |
|
sl@0
|
19 |
ifcapable !vtab||!shared_cache {
|
sl@0
|
20 |
finish_test
|
sl@0
|
21 |
return
|
sl@0
|
22 |
}
|
sl@0
|
23 |
|
sl@0
|
24 |
db close
|
sl@0
|
25 |
sqlite3_enable_shared_cache 1
|
sl@0
|
26 |
sqlite3 db test.db
|
sl@0
|
27 |
|
sl@0
|
28 |
do_test vtab_shared-1.0 {
|
sl@0
|
29 |
register_echo_module [sqlite3_connection_pointer db]
|
sl@0
|
30 |
catchsql {
|
sl@0
|
31 |
CREATE TABLE t0(a, b, c);
|
sl@0
|
32 |
CREATE VIRTUAL TABLE t1 USING echo(t0);
|
sl@0
|
33 |
}
|
sl@0
|
34 |
} {1 {Cannot use virtual tables in shared-cache mode}}
|
sl@0
|
35 |
|
sl@0
|
36 |
db close
|
sl@0
|
37 |
sqlite3_enable_shared_cache 0
|
sl@0
|
38 |
sqlite3 db test.db
|
sl@0
|
39 |
|
sl@0
|
40 |
do_test vtab_shared-1.1 {
|
sl@0
|
41 |
register_echo_module [sqlite3_connection_pointer db]
|
sl@0
|
42 |
catchsql {
|
sl@0
|
43 |
CREATE VIRTUAL TABLE t1 USING echo(t0);
|
sl@0
|
44 |
}
|
sl@0
|
45 |
} {0 {}}
|
sl@0
|
46 |
|
sl@0
|
47 |
db close
|
sl@0
|
48 |
sqlite3_enable_shared_cache 1
|
sl@0
|
49 |
sqlite3 db test.db
|
sl@0
|
50 |
|
sl@0
|
51 |
do_test vtab_shared-1.2 {
|
sl@0
|
52 |
register_echo_module [sqlite3_connection_pointer db]
|
sl@0
|
53 |
catchsql {
|
sl@0
|
54 |
SELECT * FROM t1;
|
sl@0
|
55 |
}
|
sl@0
|
56 |
} [list 1 \
|
sl@0
|
57 |
{malformed database schema (t1) - Cannot use virtual tables in shared-cache mode}]
|
sl@0
|
58 |
|
sl@0
|
59 |
db close
|
sl@0
|
60 |
sqlite3_enable_shared_cache 0
|
sl@0
|
61 |
finish_test
|