Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Coverage tests for some pragmas. (CVS 3767) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
eec7ab63beed875a3b16c3bf8d28ac4f |
User & Date: | danielk1977 2007-03-30 17:11:13.000 |
Context
2007-03-30
| ||
17:17 | Get the memleak.test script working again after recent changes. (CVS 3768) (check-in: cd6ca078e3 user: drh tags: trunk) | |
17:11 | Coverage tests for some pragmas. (CVS 3767) (check-in: eec7ab63be user: danielk1977 tags: trunk) | |
16:01 | Always enable exclusive access mode for TEMP databases. This cannot be changed. The locking_mode pragma has not effect on the TEMP database. (CVS 3766) (check-in: 04d3b9098e user: drh tags: trunk) | |
Changes
Changes to src/pragma.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 | /* ** 2003 April 6 ** ** 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 contains code used to implement the PRAGMA command. ** | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | /* ** 2003 April 6 ** ** 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 contains code used to implement the PRAGMA command. ** ** $Id: pragma.c,v 1.132 2007/03/30 17:11:13 danielk1977 Exp $ */ #include "sqliteInt.h" #include "os.h" #include <ctype.h> /* Ignore this whole file if pragmas are disabled */ |
︙ | ︙ | |||
96 97 98 99 100 101 102 | /* ** Invalidate temp storage, either when the temp storage is changed ** from default, or when 'file' and the temp_store_directory has changed */ static int invalidateTempStorage(Parse *pParse){ sqlite3 *db = pParse->db; if( db->aDb[1].pBt!=0 ){ | | | 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | /* ** Invalidate temp storage, either when the temp storage is changed ** from default, or when 'file' and the temp_store_directory has changed */ static int invalidateTempStorage(Parse *pParse){ sqlite3 *db = pParse->db; if( db->aDb[1].pBt!=0 ){ if( !db->autoCommit ){ sqlite3ErrorMsg(pParse, "temporary storage cannot be changed " "from within a transaction"); return SQLITE_ERROR; } sqlite3BtreeClose(db->aDb[1].pBt); db->aDb[1].pBt = 0; sqlite3ResetInternalSchema(db, 0); |
︙ | ︙ |
Changes to test/misc7.test.
1 2 3 4 5 6 7 8 9 10 11 12 | # 2006 September 4 # # 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 implements regression tests for SQLite library. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # 2006 September 4 # # 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 implements regression tests for SQLite library. # # $Id: misc7.test,v 1.7 2007/03/30 17:11:13 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl do_test misc7-1 { c_misuse_test } {} |
︙ | ︙ | |||
60 61 62 63 64 65 66 67 68 69 | proc use_up_files {} { set ret [list] catch { while 1 { lappend ret [open test.db] } } return $ret } execsql { CREATE TABLE abc(a PRIMARY KEY, b, c); } db close | > > > > > > > > > > > > > > > > > > > > > > > > > > > | < < < < | < < < | | | | | | < < < < | < < < > < < | < | | 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | proc use_up_files {} { set ret [list] catch { while 1 { lappend ret [open test.db] } } 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 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; } do_fileopen_test misc7-6.2 { PRAGMA temp.cache_size = 1000; } # # End of tests for out-of-file-descriptors condition. #-------------------------------------------------------------------- sqlite3 db test.db #-------------------------------------------------------------------- # Test that the sqlite3_busy_timeout call seems to delay approximately # the right amount of time. # do_test misc7-7.0 { sqlite3 db2 test.db sqlite3_busy_timeout [sqlite3_connection_pointer db] 2000 execsql { BEGIN EXCLUSIVE; } db2 # Now db2 has an exclusive lock on the database file, and db has |
︙ | ︙ | |||
212 213 214 215 216 217 218 219 220 | register_echo_module [sqlite3_connection_pointer db] set ::echo_module_cost 2.0e+99 execsql {SELECT * FROM t1 WHERE a = 1;} } {1 2 3} unset ::echo_module_cost } finish_test | > > > > > > > > > > > > > > > > > > > > | 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | register_echo_module [sqlite3_connection_pointer db] set ::echo_module_cost 2.0e+99 execsql {SELECT * FROM t1 WHERE a = 1;} } {1 2 3} 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 |
Changes to test/pragma.test.
︙ | ︙ | |||
8 9 10 11 12 13 14 | # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests for the PRAGMA command. # | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests for the PRAGMA command. # # $Id: pragma.test,v 1.52 2007/03/30 17:11:13 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Test organization: # # pragma-1.*: Test cache_size, default_cache_size and synchronous on main db. |
︙ | ︙ | |||
850 851 852 853 854 855 856 857 858 859 860 861 862 863 | } do_test pragma-9.10 { catchsql " PRAGMA temp_store_directory='$pwd'; SELECT * FROM temp_store_directory_test; " } {1 {no such table: temp_store_directory_test}} } ;# ifcapable pager_pragmas ifcapable trigger { do_test pragma-10.0 { catchsql { DROP TABLE main.t1; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 | } do_test pragma-9.10 { catchsql " PRAGMA temp_store_directory='$pwd'; 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 { do_test pragma-10.0 { catchsql { DROP TABLE main.t1; |
︙ | ︙ |