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