Add test cases to make sure virtual tables cannot be used in shared-cache mode. (CVS 3847)

FossilOrigin-Name: 66e468adfcf0132e558a666b847ce7c1e024d6fd
This commit is contained in:
danielk1977 2007-04-16 15:49:41 +00:00
parent 505a112384
commit 113e545f45
4 changed files with 77 additions and 9 deletions

View File

@ -1,5 +1,5 @@
C Make\sit\sclear\sin\sthe\sdocs\sthat\svirtual\stables\sand\sshared\scache\sdo\snot\nplay\swell\stogether.\s(CVS\s3846)
D 2007-04-16T15:35:24
C Add\stest\scases\sto\smake\ssure\svirtual\stables\scannot\sbe\sused\sin\sshared-cache\smode.\s(CVS\s3847)
D 2007-04-16T15:49:41
F Makefile.in 8cab54f7c9f5af8f22fd97ddf1ecfd1e1860de62
F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@ -131,7 +131,7 @@ F src/vdbeapi.c 1fca7ff056d03f131caa6b1296bb221da65ed7f4
F src/vdbeaux.c 0bae26de1ba1683de80c89ba1d4081b4c809d05b
F src/vdbefifo.c 3ca8049c561d5d67cbcb94dc909ae9bb68c0bf8f
F src/vdbemem.c 981a113405bd9b80aeb71fe246a2f01708e8a8f7
F src/vtab.c 6dd9dd6ef4fef10e32c05452d3dd0b8bec9d7cb6
F src/vtab.c ff222fb87e1215d9a89a357ec985e8523760346f
F src/where.c fce0dad6b230eb7ea844e8b8667c074d07e3fdd5
F tclinstaller.tcl 046e3624671962dc50f0481d7c25b38ef803eb42
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
@ -379,6 +379,7 @@ F test/vtab7.test 5f9ef9fb84733e928d5d0267c821072561b198d5
F test/vtab8.test e19fa4a538fcd1bb66c22825fa8f71618fb13583
F test/vtab9.test ea58d2b95d61955f87226381716b2d0b1d4e4f9b
F test/vtab_err.test 224cc80ad700797c48b9cd2c1e0bd7a8517d8609
F test/vtab_shared.test d631d1f820c38c18939d53aab1fc35db5f0a8094
F test/where.test 1d020f50c77f37b2dbab9766ca959e6e3278ecdb
F test/where2.test 3249d426b3fc7a106713d784e1628307fc308d2e
F test/where3.test 0a30fe9808b0fa01c46d0fcf4fac0bf6cf75bb30
@ -458,7 +459,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
P 8d6c3bfc4dfdd380a2915d778e256d3e49d22d72
R 321dbeb0f693ce1b8df9ea20fa6bdbed
U drh
Z a9e7fd4dd9f612ad453b38e74508ef23
P 62ef2b1127e76eae0f76ac51f8238446763a3aac
R 63c8f1a0e9e6f6320bde3c089061cb75
U danielk1977
Z 57c5fb7a4703a03718600740eec93793

View File

@ -1 +1 @@
62ef2b1127e76eae0f76ac51f8238446763a3aac
66e468adfcf0132e558a666b847ce7c1e024d6fd

View File

@ -11,7 +11,7 @@
*************************************************************************
** This file contains code used to help implement virtual tables.
**
** $Id: vtab.c,v 1.40 2007/04/16 15:06:26 danielk1977 Exp $
** $Id: vtab.c,v 1.41 2007/04/16 15:49:41 danielk1977 Exp $
*/
#ifndef SQLITE_OMIT_VIRTUALTABLE
#include "sqliteInt.h"
@ -132,6 +132,11 @@ void sqlite3VtabBeginParse(
int iDb; /* The database the table is being created in */
Table *pTable; /* The new virtual table */
if( sqlite3ThreadDataReadOnly()->useSharedData ){
sqlite3ErrorMsg(pParse, "Cannot use virtual tables in shared-cache mode");
return;
}
sqlite3StartTable(pParse, pName1, pName2, 0, 0, 1, 0);
pTable = pParse->pNewTable;
if( pTable==0 || pParse->nErr ) return;

62
test/vtab_shared.test Normal file
View File

@ -0,0 +1,62 @@
# 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.1 2007/04/16 15:49:42 danielk1977 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 - Cannot use virtual tables in shared-cache mode}]
db close
sqlite3_enable_shared_cache 0
finish_test