1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TclScript/vtab_shared.test Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,61 @@
1.4 +# 2007 April 16
1.5 +#
1.6 +# The author disclaims copyright to this source code. In place of
1.7 +# a legal notice, here is a blessing:
1.8 +#
1.9 +# May you do good and not evil.
1.10 +# May you find forgiveness for yourself and forgive others.
1.11 +# May you share freely, never taking more than you give.
1.12 +#
1.13 +#***********************************************************************
1.14 +# This file tests interactions between the virtual table and
1.15 +# shared-schema functionality.
1.16 +#
1.17 +# $Id: vtab_shared.test,v 1.2 2008/03/19 13:03:34 drh Exp $
1.18 +
1.19 +set testdir [file dirname $argv0]
1.20 +source $testdir/tester.tcl
1.21 +
1.22 +ifcapable !vtab||!shared_cache {
1.23 + finish_test
1.24 + return
1.25 +}
1.26 +
1.27 +db close
1.28 +sqlite3_enable_shared_cache 1
1.29 +sqlite3 db test.db
1.30 +
1.31 +do_test vtab_shared-1.0 {
1.32 + register_echo_module [sqlite3_connection_pointer db]
1.33 + catchsql {
1.34 + CREATE TABLE t0(a, b, c);
1.35 + CREATE VIRTUAL TABLE t1 USING echo(t0);
1.36 + }
1.37 +} {1 {Cannot use virtual tables in shared-cache mode}}
1.38 +
1.39 +db close
1.40 +sqlite3_enable_shared_cache 0
1.41 +sqlite3 db test.db
1.42 +
1.43 +do_test vtab_shared-1.1 {
1.44 + register_echo_module [sqlite3_connection_pointer db]
1.45 + catchsql {
1.46 + CREATE VIRTUAL TABLE t1 USING echo(t0);
1.47 + }
1.48 +} {0 {}}
1.49 +
1.50 +db close
1.51 +sqlite3_enable_shared_cache 1
1.52 +sqlite3 db test.db
1.53 +
1.54 +do_test vtab_shared-1.2 {
1.55 + register_echo_module [sqlite3_connection_pointer db]
1.56 + catchsql {
1.57 + SELECT * FROM t1;
1.58 + }
1.59 +} [list 1 \
1.60 + {malformed database schema (t1) - Cannot use virtual tables in shared-cache mode}]
1.61 +
1.62 +db close
1.63 +sqlite3_enable_shared_cache 0
1.64 +finish_test