Coverage tests for some pragmas. (CVS 3767)

FossilOrigin-Name: eec7ab63beed875a3b16c3bf8d28ac4f296dfb4c
This commit is contained in:
danielk1977 2007-03-30 17:11:12 +00:00
parent 369339db34
commit 95b289b684
5 changed files with 112 additions and 41 deletions

View File

@ -1,5 +1,5 @@
C Always\senable\sexclusive\saccess\smode\sfor\sTEMP\sdatabases.\s\sThis\scannot\sbe\nchanged.\s\sThe\slocking_mode\spragma\shas\snot\seffect\son\sthe\sTEMP\sdatabase.\s(CVS\s3766)
D 2007-03-30T16:01:55
C Coverage\stests\sfor\ssome\spragmas.\s(CVS\s3767)
D 2007-03-30T17:11:13
F Makefile.in 2f2c3bf69faf0ae7b8e8af4f94f1986849034530
F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@ -89,7 +89,7 @@ F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
F src/pager.c ae0b1e1ae9b3f7fc725b6c92cf10f2a582006e44
F src/pager.h e79a24cf200b8771366217f5bca414f5b7823f42
F src/parse.y 207ab04273ae13aa4a729b96008d294d5f334ab3
F src/pragma.c 8fd4f98822007a8d2c34e235ad3c35f1d77b3e51
F src/pragma.c 3b992b5b2640d6ae25cef05aa6a42cd1d6c43234
F src/prepare.c 37207b2b2ccb41d379b01dd62231686bcc48ef1f
F src/printf.c aade23a789d7cc88b397ec0d33a0a01a33a7a9c1
F src/random.c 6119474a6f6917f708c1dee25b9a8e519a620e88
@ -274,7 +274,7 @@ F test/misc3.test 7bd937e2c62bcc6be71939faf068d506467b1e03
F test/misc4.test b043a05dea037cca5989f3ae09552fa16119bc80
F test/misc5.test c7d2d2a5a20dc37d3605a8067f0df5af2240122e
F test/misc6.test 3de55ec5cadf466ada587173faa5d6a4790a8bb7
F test/misc7.test 54b131b86086d018e805f40916755c5d08c0eb2e
F test/misc7.test 92c5d9ea7f860ec1ecd0a18c343c7f684db6b04a
F test/misuse.test 30b3a458e5a70c31e74c291937b6c82204c59f33
F test/notnull.test 44d600f916b770def8b095a9962dbe3be5a70d82
F test/null.test 9503e1f63e959544c006d9f01709c5b5eab67d54
@ -282,7 +282,7 @@ F test/pager.test ceeef3caac4bf2046c6c06827f1a87dc1dec30f3
F test/pager2.test c025f91b75fe65e85febda64d9416428b8a5cab5
F test/pager3.test 2323bf27fd5bd887b580247e5bce500ceee994b4
F test/pagesize.test 05c74ea49f790734ec1e9ab765d9bf1cce79b8f2
F test/pragma.test 91739ef06ab9ecf91e90d25951858caba71d6fe7
F test/pragma.test 4d2696d0c5bfc4ef28324684c2f9162243800496
F test/printf.test cdd8e20dd901382a385afcbaa777b9377815c2ad
F test/progress.test 8b22b4974b0a95272566385f8cb8c341c7130df8 x
F test/quick.test c3eb0c3e37f165eed629cf806f43b4e4e1a3213e
@ -447,7 +447,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
P df64894bacd8023cf3c5939f062c8463ff5cdc04
R 46ff3e411333d7c07ca010df4bca596d
U drh
Z 515593da6a50233962143dfb23c8bb25
P 04d3b9098ed06d5be24253edde50ea61b4641df8
R ffd8a67e59aeb7e3614e6793dde03caf
U danielk1977
Z e963e7e6a18b9890e173b598bcd0b6c7

View File

@ -1 +1 @@
04d3b9098ed06d5be24253edde50ea61b4641df8
eec7ab63beed875a3b16c3bf8d28ac4f296dfb4c

View File

@ -11,7 +11,7 @@
*************************************************************************
** This file contains code used to implement the PRAGMA command.
**
** $Id: pragma.c,v 1.131 2007/03/30 11:12:08 drh Exp $
** $Id: pragma.c,v 1.132 2007/03/30 17:11:13 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@ -100,7 +100,7 @@ static int getTempStore(const char *z){
static int invalidateTempStorage(Parse *pParse){
sqlite3 *db = pParse->db;
if( db->aDb[1].pBt!=0 ){
if( db->flags & SQLITE_InTrans ){
if( !db->autoCommit ){
sqlite3ErrorMsg(pParse, "temporary storage cannot be changed "
"from within a transaction");
return SQLITE_ERROR;

View File

@ -10,7 +10,7 @@
#***********************************************************************
# This file implements regression tests for SQLite library.
#
# $Id: misc7.test,v 1.6 2007/03/30 14:56:35 danielk1977 Exp $
# $Id: misc7.test,v 1.7 2007/03/30 17:11:13 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -65,37 +65,48 @@ proc use_up_files {} {
return $ret
}
proc do_fileopen_test {prefix sql} {
set fd_list [use_up_files]
set ::go 1
set ::n 1
set ::sql $sql
while {$::go} {
catch {db close}
do_test ${prefix}.${::n} {
set rc [catch {
sqlite db test.db
db eval $::sql
} msg]
if {$rc == 0} {set ::go 0}
expr {$rc == 0 || ($rc == 1 && [string first unable $msg]==0)}
} 1
close [lindex $fd_list 0]
set fd_list [lrange $fd_list 1 end]
incr ::n
}
foreach fd $fd_list {
close $fd
}
db close
}
execsql { CREATE TABLE abc(a PRIMARY KEY, b, c); }
db close
set fd_list [use_up_files]
set ::go 1
set ::n 1
while {$::go} {
catch {db close}
do_test misc7-6.$::n {
set rc [catch {
sqlite db test.db
db eval {
BEGIN;
INSERT INTO abc VALUES(1, 2, 3);
INSERT INTO abc VALUES(2, 3, 4);
INSERT INTO abc SELECT a+2, b, c FROM abc;
COMMIT;
}
} msg]
if {$rc == 0} {set ::go 0}
expr {$rc == 0 || ($rc == 1 && $msg eq "unable to open database file")}
} 1
do_fileopen_test misc7-6.1 {
BEGIN;
INSERT INTO abc VALUES(1, 2, 3);
INSERT INTO abc VALUES(2, 3, 4);
INSERT INTO abc SELECT a+2, b, c FROM abc;
COMMIT;
}
close [lindex $fd_list 0]
set fd_list [lrange $fd_list 1 end]
incr ::n
do_fileopen_test misc7-6.2 {
PRAGMA temp.cache_size = 1000;
}
foreach fd $fd_list {
close $fd
}
db close
#
# End of tests for out-of-file-descriptors condition.
#--------------------------------------------------------------------
@ -105,7 +116,7 @@ sqlite3 db test.db
# Test that the sqlite3_busy_timeout call seems to delay approximately
# the right amount of time.
#
do_test misc7-6 {
do_test misc7-7.0 {
sqlite3 db2 test.db
sqlite3_busy_timeout [sqlite3_connection_pointer db] 2000
execsql {
@ -216,5 +227,25 @@ ifcapable vtab {
unset ::echo_module_cost
}
db close
file delete -force test.db
file delete -force test.db-journal
sqlite3 db test.db
ifcapable explain {
do_test misc7-14 {
execsql {
CREATE TABLE abc(a PRIMARY KEY, b, c);
}
execsql {
EXPLAIN QUERY PLAN SELECT * FROM abc AS t2 WHERE rowid = 1;
}
} {0 0 {TABLE abc AS t2 USING PRIMARY KEY}}
do_test misc7-15 {
execsql {
EXPLAIN QUERY PLAN SELECT * FROM abc AS t2 WHERE a = 1;
}
} {0 0 {TABLE abc AS t2 WITH INDEX sqlite_autoindex_abc_1}}
}
finish_test

View File

@ -12,7 +12,7 @@
#
# This file implements tests for the PRAGMA command.
#
# $Id: pragma.test,v 1.51 2007/01/27 14:26:07 drh Exp $
# $Id: pragma.test,v 1.52 2007/03/30 17:11:13 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -854,6 +854,46 @@ do_test pragma-9.10 {
SELECT * FROM temp_store_directory_test;
"
} {1 {no such table: temp_store_directory_test}}
do_test pragma-9.11 {
execsql {
PRAGMA temp_store = 0;
PRAGMA temp_store;
}
} {0}
do_test pragma-9.12 {
execsql {
PRAGMA temp_store = 1;
PRAGMA temp_store;
}
} {1}
do_test pragma-9.13 {
execsql {
PRAGMA temp_store = 2;
PRAGMA temp_store;
}
} {2}
do_test pragma-9.14 {
execsql {
PRAGMA temp_store = 3;
PRAGMA temp_store;
}
} {0}
breakpoint
do_test pragma-9.15 {
catchsql {
BEGIN EXCLUSIVE;
CREATE TEMP TABLE temp_table(t);
INSERT INTO temp_table VALUES('valuable data');
PRAGMA temp_store = 1;
}
} {1 {temporary storage cannot be changed from within a transaction}}
do_test pragma-9.16 {
execsql {
SELECT * FROM temp_table;
COMMIT;
}
} {{valuable data}}
} ;# ifcapable pager_pragmas
ifcapable trigger {