sl@0: # 2007 April 16 sl@0: # sl@0: # The author disclaims copyright to this source code. In place of sl@0: # a legal notice, here is a blessing: sl@0: # sl@0: # May you do good and not evil. sl@0: # May you find forgiveness for yourself and forgive others. sl@0: # May you share freely, never taking more than you give. sl@0: # sl@0: #*********************************************************************** sl@0: # This file tests interactions between the virtual table and sl@0: # shared-schema functionality. sl@0: # sl@0: # $Id: vtab_shared.test,v 1.2 2008/03/19 13:03:34 drh Exp $ sl@0: sl@0: set testdir [file dirname $argv0] sl@0: source $testdir/tester.tcl sl@0: sl@0: ifcapable !vtab||!shared_cache { sl@0: finish_test sl@0: return sl@0: } sl@0: sl@0: db close sl@0: sqlite3_enable_shared_cache 1 sl@0: sqlite3 db test.db sl@0: sl@0: do_test vtab_shared-1.0 { sl@0: register_echo_module [sqlite3_connection_pointer db] sl@0: catchsql { sl@0: CREATE TABLE t0(a, b, c); sl@0: CREATE VIRTUAL TABLE t1 USING echo(t0); sl@0: } sl@0: } {1 {Cannot use virtual tables in shared-cache mode}} sl@0: sl@0: db close sl@0: sqlite3_enable_shared_cache 0 sl@0: sqlite3 db test.db sl@0: sl@0: do_test vtab_shared-1.1 { sl@0: register_echo_module [sqlite3_connection_pointer db] sl@0: catchsql { sl@0: CREATE VIRTUAL TABLE t1 USING echo(t0); sl@0: } sl@0: } {0 {}} sl@0: sl@0: db close sl@0: sqlite3_enable_shared_cache 1 sl@0: sqlite3 db test.db sl@0: sl@0: do_test vtab_shared-1.2 { sl@0: register_echo_module [sqlite3_connection_pointer db] sl@0: catchsql { sl@0: SELECT * FROM t1; sl@0: } sl@0: } [list 1 \ sl@0: {malformed database schema (t1) - Cannot use virtual tables in shared-cache mode}] sl@0: sl@0: db close sl@0: sqlite3_enable_shared_cache 0 sl@0: finish_test