persistentstorage/sqlite3api/TEST/TclScript/vtab_shared.test
changeset 0 08ec8eefde2f
equal deleted inserted replaced
-1:000000000000 0:08ec8eefde2f
       
     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 
       
    16 set testdir [file dirname $argv0]
       
    17 source $testdir/tester.tcl
       
    18 
       
    19 ifcapable !vtab||!shared_cache {
       
    20   finish_test
       
    21   return
       
    22 }
       
    23 
       
    24 db close
       
    25 sqlite3_enable_shared_cache 1
       
    26 sqlite3 db test.db
       
    27 
       
    28 do_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 
       
    36 db close
       
    37 sqlite3_enable_shared_cache 0
       
    38 sqlite3 db test.db
       
    39 
       
    40 do_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 
       
    47 db close
       
    48 sqlite3_enable_shared_cache 1
       
    49 sqlite3 db test.db
       
    50 
       
    51 do_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 
       
    59 db close
       
    60 sqlite3_enable_shared_cache 0
       
    61 finish_test