summaryrefslogtreecommitdiffstats
path: root/third_party/sqlite/test/vtab_shared.test
blob: cfc48d9a6fdfdb43564c1047078937b95026ff69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# 2007 April 16
#
# The author disclaims copyright to this source code.  In place of
# a legal notice, here is a blessing:
#
#    May you do good and not evil.
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file tests interactions between the virtual table and
# shared-schema functionality.
#
# $Id: vtab_shared.test,v 1.2 2008/03/19 13:03:34 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

ifcapable !vtab||!shared_cache {
  finish_test
  return
}

db close
sqlite3_enable_shared_cache 1
sqlite3 db test.db

do_test vtab_shared-1.0 {
  register_echo_module [sqlite3_connection_pointer db]
  catchsql {
    CREATE TABLE t0(a, b, c);
    CREATE VIRTUAL TABLE t1 USING echo(t0);
  }
} {1 {Cannot use virtual tables in shared-cache mode}}

db close
sqlite3_enable_shared_cache 0
sqlite3 db test.db

do_test vtab_shared-1.1 {
  register_echo_module [sqlite3_connection_pointer db]
  catchsql {
    CREATE VIRTUAL TABLE t1 USING echo(t0);
  }
} {0 {}}

db close
sqlite3_enable_shared_cache 1
sqlite3 db test.db

do_test vtab_shared-1.2 {
  register_echo_module [sqlite3_connection_pointer db]
  catchsql {
    SELECT * FROM t1;
  }
} [list 1 \
  {malformed database schema (t1) - Cannot use virtual tables in shared-cache mode}]

db close
sqlite3_enable_shared_cache 0
finish_test