SQLite

Check-in [3471a2269f]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Changes to test scripts to support alternative configurations. (CVS 3824)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 3471a2269fb6b3769b59b70992e6da3bdebea7df
User & Date: drh 2007-04-06 21:42:22.000
Context
2007-04-07
15:03
For filesystem databases, do not store a list of pages in the statement journal in main memory. (CVS 3825) (check-in: 0af764a026 user: danielk1977 tags: trunk)
2007-04-06
21:42
Changes to test scripts to support alternative configurations. (CVS 3824) (check-in: 3471a2269f user: drh tags: trunk)
18:23
Additional coverage testing. (CVS 3823) (check-in: 26b2e1aede user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/test1.c.
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
**    May you share freely, never taking more than you give.
**
*************************************************************************
** Code for testing all sorts of SQLite interfaces.  This code
** is not included in the SQLite library.  It is used for automated
** testing of the SQLite library.
**
** $Id: test1.c,v 1.234 2007/04/05 17:36:19 drh Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
#include "os.h"
#include <stdlib.h>
#include <string.h>








|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
**    May you share freely, never taking more than you give.
**
*************************************************************************
** Code for testing all sorts of SQLite interfaces.  This code
** is not included in the SQLite library.  It is used for automated
** testing of the SQLite library.
**
** $Id: test1.c,v 1.235 2007/04/06 21:42:22 drh Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
#include "os.h"
#include <stdlib.h>
#include <string.h>

3974
3975
3976
3977
3978
3979
3980






3981
3982
3983
3984
3985
3986
3987
#endif

#ifdef SQLITE_OMIT_LIKE_OPTIMIZATION
  Tcl_SetVar2(interp, "sqlite_options", "like_opt", "0", TCL_GLOBAL_ONLY);
#else
  Tcl_SetVar2(interp, "sqlite_options", "like_opt", "1", TCL_GLOBAL_ONLY);
#endif







#ifdef SQLITE_OMIT_MEMORYDB
  Tcl_SetVar2(interp, "sqlite_options", "memorydb", "0", TCL_GLOBAL_ONLY);
#else
  Tcl_SetVar2(interp, "sqlite_options", "memorydb", "1", TCL_GLOBAL_ONLY);
#endif








>
>
>
>
>
>







3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
#endif

#ifdef SQLITE_OMIT_LIKE_OPTIMIZATION
  Tcl_SetVar2(interp, "sqlite_options", "like_opt", "0", TCL_GLOBAL_ONLY);
#else
  Tcl_SetVar2(interp, "sqlite_options", "like_opt", "1", TCL_GLOBAL_ONLY);
#endif

#ifdef SQLITE_OMIT_LOAD_EXTENSION
  Tcl_SetVar2(interp, "sqlite_options", "load_ext", "0", TCL_GLOBAL_ONLY);
#else
  Tcl_SetVar2(interp, "sqlite_options", "load_ext", "1", TCL_GLOBAL_ONLY);
#endif

#ifdef SQLITE_OMIT_MEMORYDB
  Tcl_SetVar2(interp, "sqlite_options", "memorydb", "0", TCL_GLOBAL_ONLY);
#else
  Tcl_SetVar2(interp, "sqlite_options", "memorydb", "1", TCL_GLOBAL_ONLY);
#endif

4113
4114
4115
4116
4117
4118
4119












4120
4121
4122
4123
4124
4125
4126
#endif

#ifdef SQLITE_DEFAULT_FILE_FORMAT
  Tcl_ObjSetVar2(interp, 
      Tcl_NewStringObj("sqlite_default_file_format", -1), 0, 
      Tcl_NewIntObj(SQLITE_DEFAULT_FILE_FORMAT), TCL_GLOBAL_ONLY
  );












#endif
}

/*
** tclcmd:   working_64bit_int
**
** Some TCL builds (ex: cygwin) do not support 64-bit integers.  This







>
>
>
>
>
>
>
>
>
>
>
>







4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
#endif

#ifdef SQLITE_DEFAULT_FILE_FORMAT
  Tcl_ObjSetVar2(interp, 
      Tcl_NewStringObj("sqlite_default_file_format", -1), 0, 
      Tcl_NewIntObj(SQLITE_DEFAULT_FILE_FORMAT), TCL_GLOBAL_ONLY
  );
#endif
#ifdef SQLITE_MAX_PAGE_SIZE
  Tcl_ObjSetVar2(interp, 
      Tcl_NewStringObj("SQLITE_MAX_PAGE_SIZE", -1), 0, 
      Tcl_NewIntObj(SQLITE_MAX_PAGE_SIZE), TCL_GLOBAL_ONLY
  );
#endif
#ifdef TEMP_STORE
  Tcl_ObjSetVar2(interp, 
      Tcl_NewStringObj("TEMP_STORE", -1), 0, 
      Tcl_NewIntObj(TEMP_STORE), TCL_GLOBAL_ONLY
  );
#endif
}

/*
** tclcmd:   working_64bit_int
**
** Some TCL builds (ex: cygwin) do not support 64-bit integers.  This
Changes to test/cache.test.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 2007 March 24
#
# 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.
#
#***********************************************************************
#
# $Id: cache.test,v 1.1 2007/04/02 05:07:48 danielk1977 Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

ifcapable {!pager_pragmas} {
  finish_test
  return











|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 2007 March 24
#
# 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.
#
#***********************************************************************
#
# $Id: cache.test,v 1.2 2007/04/06 21:42:22 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

ifcapable {!pager_pragmas} {
  finish_test
  return
27
28
29
30
31
32
33

34
35
36
37
38
39
40

do_test cache-1.1 {
  pager_cache_size db
} {0}

do_test cache-1.2 {
  execsql {

    CREATE TABLE abc(a, b, c);
    INSERT INTO abc VALUES(1, 2, 3);
  }
  pager_cache_size db
} {2}

# At one point, repeatedly locking and unlocking the cache was causing







>







27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

do_test cache-1.1 {
  pager_cache_size db
} {0}

do_test cache-1.2 {
  execsql {
    PRAGMA auto_vacuum=OFF;
    CREATE TABLE abc(a, b, c);
    INSERT INTO abc VALUES(1, 2, 3);
  }
  pager_cache_size db
} {2}

# At one point, repeatedly locking and unlocking the cache was causing
Changes to test/conflict.test.
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#
#***********************************************************************
# This file implements regression tests for SQLite library.
#
# This file implements tests for the conflict resolution extension
# to SQLite.
#
# $Id: conflict.test,v 1.28 2007/01/03 23:37:29 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

ifcapable !conflict {
  finish_test
  return







|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#
#***********************************************************************
# This file implements regression tests for SQLite library.
#
# This file implements tests for the conflict resolution extension
# to SQLite.
#
# $Id: conflict.test,v 1.29 2007/04/06 21:42:22 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

ifcapable !conflict {
  finish_test
  return
278
279
280
281
282
283
284
285

286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305





306
307
308
309
310
311
312
313
314
315
316
317
318
319
#
#   i      The reference number of the test
#   conf1  The conflict resolution algorithm on the UNIQUE constraint
#   cmd    An UPDATE command to execute against table t1
#   t0     True if there is an error from $cmd
#   t1     Content of "b" column of t1 assuming no error in $cmd
#   t2     Content of "x" column of t3
#   t3     Number of temporary files created

#
foreach {i conf1 cmd t0 t1 t2 t3} {
  1 {}       UPDATE                  1 {6 7 8 9}  1 1
  2 REPLACE  UPDATE                  0 {7 6 9}    1 1
  3 IGNORE   UPDATE                  0 {6 7 3 9}  1 1
  4 FAIL     UPDATE                  1 {6 7 3 4}  1 0
  5 ABORT    UPDATE                  1 {1 2 3 4}  1 1
  6 ROLLBACK UPDATE                  1 {1 2 3 4}  0 0
  7 REPLACE  {UPDATE OR IGNORE}      0 {6 7 3 9}  1 1
  8 IGNORE   {UPDATE OR REPLACE}     0 {7 6 9}    1 1
  9 FAIL     {UPDATE OR IGNORE}      0 {6 7 3 9}  1 1
 10 ABORT    {UPDATE OR REPLACE}     0 {7 6 9}    1 1
 11 ROLLBACK {UPDATE OR IGNORE}      0 {6 7 3 9}  1 1
 12 {}       {UPDATE OR IGNORE}      0 {6 7 3 9}  1 1
 13 {}       {UPDATE OR REPLACE}     0 {7 6 9}    1 1
 14 {}       {UPDATE OR FAIL}        1 {6 7 3 4}  1 0
 15 {}       {UPDATE OR ABORT}       1 {1 2 3 4}  1 1
 16 {}       {UPDATE OR ROLLBACK}    1 {1 2 3 4}  0 0
} {
  if {$t0} {set t1 {column a is not unique}}





  do_test conflict-6.$i {
    db close
    sqlite3 db test.db 
    if {$conf1!=""} {set conf1 "ON CONFLICT $conf1"}
    execsql {pragma temp_store=file}
    set ::sqlite_opentemp_count 0
if {$i==2} btree_breakpoint
    set r0 [catch {execsql [subst {
      DROP TABLE t1;
      CREATE TABLE t1(a,b,c, UNIQUE(a) $conf1);
      INSERT INTO t1 SELECT * FROM t2;
      UPDATE t3 SET x=0;
      BEGIN;
      $cmd t3 SET x=1;







|
>

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|


>
>
>
>
>






<







278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317

318
319
320
321
322
323
324
#
#   i      The reference number of the test
#   conf1  The conflict resolution algorithm on the UNIQUE constraint
#   cmd    An UPDATE command to execute against table t1
#   t0     True if there is an error from $cmd
#   t1     Content of "b" column of t1 assuming no error in $cmd
#   t2     Content of "x" column of t3
#   t3     Number of temporary files for tables
#   t4     Number of temporary files for statement journals
#
foreach {i conf1 cmd t0 t1 t2 t3 t4} {
  1 {}       UPDATE                  1 {6 7 8 9}  1 0 1
  2 REPLACE  UPDATE                  0 {7 6 9}    1 1 0
  3 IGNORE   UPDATE                  0 {6 7 3 9}  1 1 0
  4 FAIL     UPDATE                  1 {6 7 3 4}  1 0 0
  5 ABORT    UPDATE                  1 {1 2 3 4}  1 0 1
  6 ROLLBACK UPDATE                  1 {1 2 3 4}  0 0 0
  7 REPLACE  {UPDATE OR IGNORE}      0 {6 7 3 9}  1 1 0
  8 IGNORE   {UPDATE OR REPLACE}     0 {7 6 9}    1 1 0
  9 FAIL     {UPDATE OR IGNORE}      0 {6 7 3 9}  1 1 0
 10 ABORT    {UPDATE OR REPLACE}     0 {7 6 9}    1 1 0
 11 ROLLBACK {UPDATE OR IGNORE}      0 {6 7 3 9}  1 1 0
 12 {}       {UPDATE OR IGNORE}      0 {6 7 3 9}  1 1 0
 13 {}       {UPDATE OR REPLACE}     0 {7 6 9}    1 1 0
 14 {}       {UPDATE OR FAIL}        1 {6 7 3 4}  1 0 0
 15 {}       {UPDATE OR ABORT}       1 {1 2 3 4}  1 0 1
 16 {}       {UPDATE OR ROLLBACK}    1 {1 2 3 4}  0 0 0
} {
  if {$t0} {set t1 {column a is not unique}}
  if {[info exists TEMP_STORE] && $TEMP_STORE>=2} {
    set t3 $t4
  } else {
    set t3 [expr {$t3+$t4}]
  }
  do_test conflict-6.$i {
    db close
    sqlite3 db test.db 
    if {$conf1!=""} {set conf1 "ON CONFLICT $conf1"}
    execsql {pragma temp_store=file}
    set ::sqlite_opentemp_count 0

    set r0 [catch {execsql [subst {
      DROP TABLE t1;
      CREATE TABLE t1(a,b,c, UNIQUE(a) $conf1);
      INSERT INTO t1 SELECT * FROM t2;
      UPDATE t3 SET x=0;
      BEGIN;
      $cmd t3 SET x=1;
Changes to test/corrupt3.test.
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

33
34
35
36
37
38
39
#
#***********************************************************************
# This file implements regression tests for SQLite library.
#
# This file implements tests to make sure SQLite does not crash or
# segfault if it sees a corrupt database file.
#
# $Id: corrupt3.test,v 1.1 2007/04/06 15:02:14 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

# We must have the page_size pragma for these tests to work.
#
ifcapable !pager_pragmas {
  finish_test
  return
}

# Create a database with an overflow page.
#
do_test corrupt3-1.1 {
  set bigstring [string repeat 0123456789 200]
  execsql {

    PRAGMA page_size=1024;
    CREATE TABLE t1(x);
    INSERT INTO t1 VALUES($bigstring);
  }
  file size test.db
} [expr {1024*3}]








|
















>







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#
#***********************************************************************
# This file implements regression tests for SQLite library.
#
# This file implements tests to make sure SQLite does not crash or
# segfault if it sees a corrupt database file.
#
# $Id: corrupt3.test,v 1.2 2007/04/06 21:42:22 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

# We must have the page_size pragma for these tests to work.
#
ifcapable !pager_pragmas {
  finish_test
  return
}

# Create a database with an overflow page.
#
do_test corrupt3-1.1 {
  set bigstring [string repeat 0123456789 200]
  execsql {
    PRAGMA auto_vacuum=OFF;
    PRAGMA page_size=1024;
    CREATE TABLE t1(x);
    INSERT INTO t1 VALUES($bigstring);
  }
  file size test.db
} [expr {1024*3}]

Changes to test/crash2.test.
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

35
36
37
38
39
40
41
#
# The focus of this file is testing the ability of the database to
# uses its rollback journal to recover intact (no database corruption)
# from a power failure during the middle of a COMMIT. Even more
# specifically, the tests in this file verify this functionality
# for storage mediums with various sector sizes.
#
# $Id: crash2.test,v 1.3 2007/03/19 15:04:54 danielk1977 Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

ifcapable !crashtest {
  finish_test
  return
}

# This test is designed to check that the crash-test infrastructure
# can create files that do not consist of an integer number of
# simulated disk blocks (i.e. 3KB file using 2KB disk blocks).
#
do_test crash2-1.1 {
  crashsql -delay 500 -file test.db -blocksize 2048 {

    BEGIN;
    CREATE TABLE abc AS SELECT 1 AS a, 2 AS b, 3 AS c;
    CREATE TABLE def AS SELECT 1 AS d, 2 AS e, 3 AS f;
    COMMIT;
  }
  file size test.db
} {3072}







|















>







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#
# The focus of this file is testing the ability of the database to
# uses its rollback journal to recover intact (no database corruption)
# from a power failure during the middle of a COMMIT. Even more
# specifically, the tests in this file verify this functionality
# for storage mediums with various sector sizes.
#
# $Id: crash2.test,v 1.4 2007/04/06 21:42:22 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

ifcapable !crashtest {
  finish_test
  return
}

# This test is designed to check that the crash-test infrastructure
# can create files that do not consist of an integer number of
# simulated disk blocks (i.e. 3KB file using 2KB disk blocks).
#
do_test crash2-1.1 {
  crashsql -delay 500 -file test.db -blocksize 2048 {
    PRAGMA auto_vacuum=OFF;
    BEGIN;
    CREATE TABLE abc AS SELECT 1 AS a, 2 AS b, 3 AS c;
    CREATE TABLE def AS SELECT 1 AS d, 2 AS e, 3 AS f;
    COMMIT;
  }
  file size test.db
} {3072}
117
118
119
120
121
122
123
124
  } {1 {child process exited abnormally}}
  do_test crash-3.$i.2 {
    signature
  } $sig
} 

finish_test








<
118
119
120
121
122
123
124

  } {1 {child process exited abnormally}}
  do_test crash-3.$i.2 {
    signature
  } $sig
} 

finish_test

Changes to test/exclusive.test.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30









31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library. The focus
# of these tests is exclusive access mode (i.e. the thing activated by 
# "PRAGMA locking_mode = EXCLUSIVE").
#
# $Id: exclusive.test,v 1.4 2007/03/30 16:01:55 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

ifcapable {!pager_pragmas} {
  finish_test
  return
}

file delete -force test2.db-journal
file delete -force test2.db
file delete -force test3.db-journal
file delete -force test3.db
file delete -force test4.db-journal
file delete -force test4.db










#----------------------------------------------------------------------
# Test cases exclusive-1.X test the PRAGMA logic.
#
do_test exclusive-1.0 {
  execsql {
    pragma locking_mode;
    pragma main.locking_mode;
    pragma temp.locking_mode;
  } 
} {normal normal exclusive}
do_test exclusive-1.1 {
  execsql {
    pragma locking_mode = exclusive;
  } 
} {exclusive}
do_test exclusive-1.2 {
  execsql {
    pragma locking_mode;
    pragma main.locking_mode;
    pragma temp.locking_mode;
  } 
} {exclusive exclusive exclusive}
do_test exclusive-1.3 {
  execsql {
    pragma locking_mode = normal;
  } 
} {normal}
do_test exclusive-1.4 {
  execsql {
    pragma locking_mode;
    pragma main.locking_mode;
    pragma temp.locking_mode;
  } 
} {normal normal exclusive}
do_test exclusive-1.5 {
  execsql {
    pragma locking_mode = invalid;
  } 
} {normal}
do_test exclusive-1.6 {
  execsql {
    pragma locking_mode;
    pragma main.locking_mode;
    pragma temp.locking_mode;
  } 
} {normal normal exclusive}
do_test exclusive-1.7 {
  execsql {
    pragma locking_mode = exclusive;
    ATTACH 'test2.db' as aux;
  }
  execsql {
    pragma main.locking_mode;
    pragma aux.locking_mode;
  }
} {exclusive exclusive}
do_test exclusive-1.8 {
  execsql {
    pragma main.locking_mode = normal;
  }
  execsql {
    pragma main.locking_mode;
    pragma temp.locking_mode;
    pragma aux.locking_mode;
  }
} {normal exclusive exclusive}
do_test exclusive-1.9 {
  execsql {
    pragma locking_mode;
  }
} {exclusive}
do_test exclusive-1.10 {
  execsql {







|















>
>
>
>
>
>
>
>
>










|











|











|











|



















|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library. The focus
# of these tests is exclusive access mode (i.e. the thing activated by 
# "PRAGMA locking_mode = EXCLUSIVE").
#
# $Id: exclusive.test,v 1.5 2007/04/06 21:42:22 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

ifcapable {!pager_pragmas} {
  finish_test
  return
}

file delete -force test2.db-journal
file delete -force test2.db
file delete -force test3.db-journal
file delete -force test3.db
file delete -force test4.db-journal
file delete -force test4.db

# The locking mode for the TEMP table is always "exclusive" for
# on-disk tables and "normal" for in-memory tables.
#
if {[info exists TEMP_STORE] && $TEMP_STORE>=2} {
  set temp_mode normal
} else {
  set temp_mode exclusive
}

#----------------------------------------------------------------------
# Test cases exclusive-1.X test the PRAGMA logic.
#
do_test exclusive-1.0 {
  execsql {
    pragma locking_mode;
    pragma main.locking_mode;
    pragma temp.locking_mode;
  } 
} [list normal normal $temp_mode]
do_test exclusive-1.1 {
  execsql {
    pragma locking_mode = exclusive;
  } 
} {exclusive}
do_test exclusive-1.2 {
  execsql {
    pragma locking_mode;
    pragma main.locking_mode;
    pragma temp.locking_mode;
  } 
} [list exclusive exclusive $temp_mode]
do_test exclusive-1.3 {
  execsql {
    pragma locking_mode = normal;
  } 
} {normal}
do_test exclusive-1.4 {
  execsql {
    pragma locking_mode;
    pragma main.locking_mode;
    pragma temp.locking_mode;
  } 
} [list normal normal $temp_mode]
do_test exclusive-1.5 {
  execsql {
    pragma locking_mode = invalid;
  } 
} {normal}
do_test exclusive-1.6 {
  execsql {
    pragma locking_mode;
    pragma main.locking_mode;
    pragma temp.locking_mode;
  } 
} [list normal normal $temp_mode]
do_test exclusive-1.7 {
  execsql {
    pragma locking_mode = exclusive;
    ATTACH 'test2.db' as aux;
  }
  execsql {
    pragma main.locking_mode;
    pragma aux.locking_mode;
  }
} {exclusive exclusive}
do_test exclusive-1.8 {
  execsql {
    pragma main.locking_mode = normal;
  }
  execsql {
    pragma main.locking_mode;
    pragma temp.locking_mode;
    pragma aux.locking_mode;
  }
} [list normal $temp_mode exclusive]
do_test exclusive-1.9 {
  execsql {
    pragma locking_mode;
  }
} {exclusive}
do_test exclusive-1.10 {
  execsql {
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
  }
  execsql {
    pragma main.locking_mode;
    pragma temp.locking_mode;
    pragma aux.locking_mode;
    pragma aux2.locking_mode;
  }
} {normal exclusive normal normal}
do_test exclusive-1.13 {
  execsql {
    ATTACH 'test4.db' as aux3;
  }
  execsql {
    pragma main.locking_mode;
    pragma temp.locking_mode;
    pragma aux.locking_mode;
    pragma aux2.locking_mode;
    pragma aux3.locking_mode;
  }
} {normal exclusive normal normal normal}

do_test exclusive-1.99 {
  execsql {
    DETACH aux;
    DETACH aux2;
    DETACH aux3;
  }







|











|







135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
  }
  execsql {
    pragma main.locking_mode;
    pragma temp.locking_mode;
    pragma aux.locking_mode;
    pragma aux2.locking_mode;
  }
} [list normal $temp_mode normal normal]
do_test exclusive-1.13 {
  execsql {
    ATTACH 'test4.db' as aux3;
  }
  execsql {
    pragma main.locking_mode;
    pragma temp.locking_mode;
    pragma aux.locking_mode;
    pragma aux2.locking_mode;
    pragma aux3.locking_mode;
  }
} [list normal $temp_mode normal normal normal]

do_test exclusive-1.99 {
  execsql {
    DETACH aux;
    DETACH aux2;
    DETACH aux3;
  }
Changes to test/filefmt.test.
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 to verify database file format.
#
# $Id: filefmt.test,v 1.1 2007/04/06 15:02:14 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl
db close
file delete -force test.db test.db-journal

# Database begins with valid 16-byte header string.







|







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 to verify database file format.
#
# $Id: filefmt.test,v 1.2 2007/04/06 21:42:22 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl
db close
file delete -force test.db test.db-journal

# Database begins with valid 16-byte header string.
49
50
51
52
53
54
55


56
57
58
59

60
61
62
63
64
65
66
  }
} {0 1}

# The page-size is stored at offset 16
#
ifcapable pager_pragmas {
  foreach pagesize {512 1024 2048 4096 8192 16384 32768} {


     do_test filefmt-1.5.$pagesize.1 {
       db close
       file delete -force test.db
       sqlite3 db test.db

       db eval "PRAGMA page_size=$pagesize"
       db eval {CREATE TABLE t1(x)}
       file size test.db
     } [expr $pagesize*2]
     do_test filefmt-1.5.$pagesize.2 {
       hexio_get_int [hexio_read test.db 16 2]
     } $pagesize







>
>




>







49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
  }
} {0 1}

# The page-size is stored at offset 16
#
ifcapable pager_pragmas {
  foreach pagesize {512 1024 2048 4096 8192 16384 32768} {
     if {[info exists SQLITE_MAX_PAGE_SIZE]
          && $pagesize>$SQLITE_MAX_PAGE_SIZE} continue
     do_test filefmt-1.5.$pagesize.1 {
       db close
       file delete -force test.db
       sqlite3 db test.db
       db eval "PRAGMA auto_vacuum=OFF"
       db eval "PRAGMA page_size=$pagesize"
       db eval {CREATE TABLE t1(x)}
       file size test.db
     } [expr $pagesize*2]
     do_test filefmt-1.5.$pagesize.2 {
       hexio_get_int [hexio_read test.db 16 2]
     } $pagesize
Changes to test/loadext.test.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17





18
19
20
21
22
23
24
# 2006 July 14
#
# 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.  The
# focus of this script is extension loading.
#
# $Id: loadext.test,v 1.8 2006/08/23 20:07:22 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl






# The name of the test extension varies by operating system.
#
if {$::tcl_platform(platform) eq "windows"} {
  set testextension ./testloadext.dll
} else {
  set testextension ./libtestloadext.so













|



>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# 2006 July 14
#
# 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.  The
# focus of this script is extension loading.
#
# $Id: loadext.test,v 1.9 2007/04/06 21:42:22 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

ifcapable !load_ext {
  finish_test
  return
}

# The name of the test extension varies by operating system.
#
if {$::tcl_platform(platform) eq "windows"} {
  set testextension ./testloadext.dll
} else {
  set testextension ./libtestloadext.so
Changes to test/loadext2.test.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22




23
24
25
26
27
28
29
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this script is automatic extension loading and the
# sqlite3_auto_extension() API.
#
# $Id: loadext2.test,v 1.1 2006/08/23 20:07:22 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

# Only run these tests if the approriate APIs are defined
# in the system under test.
#




if {[info command sqlite3_auto_extension_sqr]==""} {
  finish_test
  return
}


# None of the extension are loaded by default.







|







>
>
>
>







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this script is automatic extension loading and the
# sqlite3_auto_extension() API.
#
# $Id: loadext2.test,v 1.2 2007/04/06 21:42:22 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

# Only run these tests if the approriate APIs are defined
# in the system under test.
#
ifcapable !load_ext {
  finish_test
  return
}
if {[info command sqlite3_auto_extension_sqr]==""} {
  finish_test
  return
}


# None of the extension are loaded by default.
Changes to test/lock4.test.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22


23

24
25
26



27
28
29
30
31
32
33
# 2007 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 implements regression tests for SQLite library.  The
# focus of this script is database locks.
#
# $Id: lock4.test,v 1.3 2007/04/06 18:23:19 drh Exp $


set testdir [file dirname $argv0]
source $testdir/tester.tcl

# Initialize the test.db database so that it is non-empty
#
do_test lock4-1.1 {


  db eval {CREATE TABLE t1(x)}

  file delete -force test2.db test2.db-journal
  sqlite3 db2 test2.db
  db2 eval {CREATE TABLE t2(x)}



  db2 close
  list [file size test.db] [file size test2.db]
} {2048 2048}

# Create a script to drive a separate process that will
#
#     1.  Create a second database test2.db













|








>
>
|
>


|
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# 2007 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 implements regression tests for SQLite library.  The
# focus of this script is database locks.
#
# $Id: lock4.test,v 1.4 2007/04/06 21:42:22 drh Exp $


set testdir [file dirname $argv0]
source $testdir/tester.tcl

# Initialize the test.db database so that it is non-empty
#
do_test lock4-1.1 {
  db eval {
     PRAGMA auto_vacuum=OFF;
     CREATE TABLE t1(x);
  }
  file delete -force test2.db test2.db-journal
  sqlite3 db2 test2.db
  db2 eval {
     PRAGMA auto_vacuum=OFF;
     CREATE TABLE t2(x)
  }
  db2 close
  list [file size test.db] [file size test2.db]
} {2048 2048}

# Create a script to drive a separate process that will
#
#     1.  Create a second database test2.db
Changes to test/pagesize.test.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 2004 September 2
#
# 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.
# This file implements tests for the page_size PRAGMA.
#
# $Id: pagesize.test,v 1.11 2006/01/17 09:35:02 danielk1977 Exp $


set testdir [file dirname $argv0]
source $testdir/tester.tcl

# This test script depends entirely on "PRAGMA page_size". So if this
# pragma is not available, omit the whole file.













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 2004 September 2
#
# 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.
# This file implements tests for the page_size PRAGMA.
#
# $Id: pagesize.test,v 1.12 2007/04/06 21:42:22 drh Exp $


set testdir [file dirname $argv0]
source $testdir/tester.tcl

# This test script depends entirely on "PRAGMA page_size". So if this
# pragma is not available, omit the whole file.
51
52
53
54
55
56
57

58
59
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
} 1024
do_test pagesize-1.5 {
  execsql {
    PRAGMA page_size=512;
    PRAGMA page_size;
  }
} 512

do_test pagesize-1.6 {
  execsql {
    PRAGMA page_size=8192;
    PRAGMA page_size;
  }
} 8192
do_test pagesize-1.7 {
  execsql {
    PRAGMA page_size=65537;
    PRAGMA page_size;
  }
} 8192
do_test pagesize-1.8 {
  execsql {
    PRAGMA page_size=1234;
    PRAGMA page_size
  }
} 8192

foreach PGSZ {512 2048 4096 8192} {


  ifcapable memorydb {
    do_test pagesize-2.$PGSZ.0 {
      db close
      sqlite3 db :memory:
      execsql "PRAGMA page_size=$PGSZ;"
      execsql {PRAGMA page_size}
    } 1024







>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|

>
>







51
52
53
54
55
56
57
58
59
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
} 1024
do_test pagesize-1.5 {
  execsql {
    PRAGMA page_size=512;
    PRAGMA page_size;
  }
} 512
if {![info exists SQLITE_MAX_PAGE_SIZE] || $SQLITE_MAX_PAGE_SIZE>=8192} {
  do_test pagesize-1.6 {
    execsql {
      PRAGMA page_size=8192;
      PRAGMA page_size;
    }
  } 8192
  do_test pagesize-1.7 {
    execsql {
      PRAGMA page_size=65537;
      PRAGMA page_size;
    }
  } 8192
  do_test pagesize-1.8 {
    execsql {
      PRAGMA page_size=1234;
      PRAGMA page_size
    }
  } 8192
}  
foreach PGSZ {512 2048 4096 8192} {
  if {[info exists SQLITE_MAX_PAGE_SIZE]
           && $SQLITE_MAX_PAGE_SIZE<$PGSZ} continue
  ifcapable memorydb {
    do_test pagesize-2.$PGSZ.0 {
      db close
      sqlite3 db :memory:
      execsql "PRAGMA page_size=$PGSZ;"
      execsql {PRAGMA page_size}
    } 1024
Changes to test/pragma.test.
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.







|







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.53 2007/04/06 21:42:22 drh 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.
41
42
43
44
45
46
47
48

49


50
51
52
53
54
55
56
57
58
59
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
# Delete the preexisting database to avoid the special setup
# that the "all.test" script does.
#
db close
file delete test.db test.db-journal
file delete test3.db test3.db-journal
sqlite3 db test.db; set DB [sqlite3_connection_pointer db]


ifcapable pager_pragmas {


do_test pragma-1.1 {
  execsql {
    PRAGMA cache_size;
    PRAGMA default_cache_size;
    PRAGMA synchronous;
  }
} {2000 2000 2}
do_test pragma-1.2 {
  execsql {
    PRAGMA synchronous=OFF;
    PRAGMA cache_size=1234;
    PRAGMA cache_size;
    PRAGMA default_cache_size;
    PRAGMA synchronous;
  }
} {1234 2000 0}
do_test pragma-1.3 {
  db close
  sqlite3 db test.db
  execsql {
    PRAGMA cache_size;
    PRAGMA default_cache_size;
    PRAGMA synchronous;
  }
} {2000 2000 2}
do_test pragma-1.4 {
  execsql {
    PRAGMA synchronous=OFF;
    PRAGMA cache_size;
    PRAGMA default_cache_size;
    PRAGMA synchronous;
  }
} {2000 2000 0}
do_test pragma-1.5 {
  execsql {
    PRAGMA cache_size=4321;
    PRAGMA cache_size;
    PRAGMA default_cache_size;
    PRAGMA synchronous;
  }
} {4321 2000 0}
do_test pragma-1.6 {
  execsql {
    PRAGMA synchronous=ON;
    PRAGMA cache_size;
    PRAGMA default_cache_size;
    PRAGMA synchronous;
  }
} {4321 2000 1}
do_test pragma-1.7 {
  db close
  sqlite3 db test.db
  execsql {
    PRAGMA cache_size;
    PRAGMA default_cache_size;
    PRAGMA synchronous;
  }
} {2000 2000 2}
do_test pragma-1.8 {
  execsql {
    PRAGMA default_cache_size=123;
    PRAGMA cache_size;
    PRAGMA default_cache_size;
    PRAGMA synchronous;
  }








>

>
>






|








|








|







|







|







|








|







41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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
# Delete the preexisting database to avoid the special setup
# that the "all.test" script does.
#
db close
file delete test.db test.db-journal
file delete test3.db test3.db-journal
sqlite3 db test.db; set DB [sqlite3_connection_pointer db]


ifcapable pager_pragmas {
set DFLT_CACHE_SZ [db one {PRAGMA default_cache_size}]
set TEMP_CACHE_SZ [db one {PRAGMA temp.default_cache_size}]
do_test pragma-1.1 {
  execsql {
    PRAGMA cache_size;
    PRAGMA default_cache_size;
    PRAGMA synchronous;
  }
} [list $DFLT_CACHE_SZ $DFLT_CACHE_SZ 2]
do_test pragma-1.2 {
  execsql {
    PRAGMA synchronous=OFF;
    PRAGMA cache_size=1234;
    PRAGMA cache_size;
    PRAGMA default_cache_size;
    PRAGMA synchronous;
  }
} [list 1234 $DFLT_CACHE_SZ 0]
do_test pragma-1.3 {
  db close
  sqlite3 db test.db
  execsql {
    PRAGMA cache_size;
    PRAGMA default_cache_size;
    PRAGMA synchronous;
  }
} [list $DFLT_CACHE_SZ $DFLT_CACHE_SZ 2]
do_test pragma-1.4 {
  execsql {
    PRAGMA synchronous=OFF;
    PRAGMA cache_size;
    PRAGMA default_cache_size;
    PRAGMA synchronous;
  }
} [list $DFLT_CACHE_SZ $DFLT_CACHE_SZ 0]
do_test pragma-1.5 {
  execsql {
    PRAGMA cache_size=4321;
    PRAGMA cache_size;
    PRAGMA default_cache_size;
    PRAGMA synchronous;
  }
} [list 4321 $DFLT_CACHE_SZ 0]
do_test pragma-1.6 {
  execsql {
    PRAGMA synchronous=ON;
    PRAGMA cache_size;
    PRAGMA default_cache_size;
    PRAGMA synchronous;
  }
} [list 4321 $DFLT_CACHE_SZ 1]
do_test pragma-1.7 {
  db close
  sqlite3 db test.db
  execsql {
    PRAGMA cache_size;
    PRAGMA default_cache_size;
    PRAGMA synchronous;
  }
} [list $DFLT_CACHE_SZ $DFLT_CACHE_SZ 2]
do_test pragma-1.8 {
  execsql {
    PRAGMA default_cache_size=123;
    PRAGMA cache_size;
    PRAGMA default_cache_size;
    PRAGMA synchronous;
  }
233
234
235
236
237
238
239



240

241
242
243
244
245
246
247

# Construct a corrupted index and make sure the integrity_check
# pragma finds it.
#
# These tests won't work if the database is encrypted
#
do_test pragma-3.1 {



  execsql {

    BEGIN;
    CREATE TABLE t2(a,b,c);
    CREATE INDEX i2 ON t2(a);
    INSERT INTO t2 VALUES(11,2,3);
    INSERT INTO t2 VALUES(22,3,4);
    COMMIT;
    SELECT rowid, * from t2;







>
>
>

>







236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254

# Construct a corrupted index and make sure the integrity_check
# pragma finds it.
#
# These tests won't work if the database is encrypted
#
do_test pragma-3.1 {
  db close
  file delete -force test.db test.db-journal
  sqlite3 db test.db
  execsql {
    PRAGMA auto_vacuum=OFF;
    BEGIN;
    CREATE TABLE t2(a,b,c);
    CREATE INDEX i2 ON t2(a);
    INSERT INTO t2 VALUES(11,2,3);
    INSERT INTO t2 VALUES(22,3,4);
    COMMIT;
    SELECT rowid, * from t2;
397
398
399
400
401
402
403

404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
  catchsql {DROP INDEX i2}
} {0 {}}

# Test modifying the cache_size of an attached database.
ifcapable pager_pragmas {
do_test pragma-4.1 {
  execsql {

    pragma aux.cache_size;
    pragma aux.default_cache_size;
  } 
} {2000 2000}
do_test pragma-4.2 {
  execsql {
    pragma aux.cache_size = 50;
    pragma aux.cache_size;
    pragma aux.default_cache_size;
  } 
} {50 2000}
do_test pragma-4.3 {
  execsql {
    pragma aux.default_cache_size = 456;
    pragma aux.cache_size;
    pragma aux.default_cache_size;
  } 
} {456 456}
do_test pragma-4.4 {
  execsql {
    pragma cache_size;
    pragma default_cache_size;
  } 
} {123 123}
do_test pragma-4.5 {
  execsql {
    DETACH aux;
    ATTACH 'test3.db' AS aux;
    pragma aux.cache_size;
    pragma aux.default_cache_size;
  } 
} {2000 2000}
do_test pragma-4.6 {
  execsql {
    DETACH aux;
    ATTACH 'test2.db' AS aux;
    pragma aux.cache_size;
    pragma aux.default_cache_size;
  } 







>



|






|












|







|







404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
  catchsql {DROP INDEX i2}
} {0 {}}

# Test modifying the cache_size of an attached database.
ifcapable pager_pragmas {
do_test pragma-4.1 {
  execsql {
    ATTACH 'test2.db' AS aux;
    pragma aux.cache_size;
    pragma aux.default_cache_size;
  } 
} [list $DFLT_CACHE_SZ $DFLT_CACHE_SZ]
do_test pragma-4.2 {
  execsql {
    pragma aux.cache_size = 50;
    pragma aux.cache_size;
    pragma aux.default_cache_size;
  } 
} [list 50 $DFLT_CACHE_SZ]
do_test pragma-4.3 {
  execsql {
    pragma aux.default_cache_size = 456;
    pragma aux.cache_size;
    pragma aux.default_cache_size;
  } 
} {456 456}
do_test pragma-4.4 {
  execsql {
    pragma cache_size;
    pragma default_cache_size;
  } 
} [list $DFLT_CACHE_SZ $DFLT_CACHE_SZ]
do_test pragma-4.5 {
  execsql {
    DETACH aux;
    ATTACH 'test3.db' AS aux;
    pragma aux.cache_size;
    pragma aux.default_cache_size;
  } 
} [list $DFLT_CACHE_SZ $DFLT_CACHE_SZ]
do_test pragma-4.6 {
  execsql {
    DETACH aux;
    ATTACH 'test2.db' AS aux;
    pragma aux.cache_size;
    pragma aux.default_cache_size;
  } 
833
834
835
836
837
838
839

840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857

858
859
860
861
862
863
864
  }
} {1 {not a writable directory}}
do_test pragma-9.8 {
  execsql { 
    PRAGMA temp_store_directory='';
  }
} {}

ifcapable tempdb {
  do_test pragma-9.9 {
    execsql { 
      PRAGMA temp_store_directory;
      PRAGMA temp_store=FILE;
      CREATE TEMP TABLE temp_store_directory_test(a integer);
      INSERT INTO temp_store_directory_test values (2);
      SELECT * FROM temp_store_directory_test;
    }
  } {2}
}
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 {







>
|
|
|
|
|
|
|
|
|
|
<
|
|
|
|
|
|
|
>







841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858

859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
  }
} {1 {not a writable directory}}
do_test pragma-9.8 {
  execsql { 
    PRAGMA temp_store_directory='';
  }
} {}
if {![info exists TEMP_STORE] || $TEMP_STORE<=1} {
  ifcapable tempdb {
    do_test pragma-9.9 {
      execsql { 
        PRAGMA temp_store_directory;
        PRAGMA temp_store=FILE;
        CREATE TEMP TABLE temp_store_directory_test(a integer);
        INSERT INTO temp_store_directory_test values (2);
        SELECT * FROM temp_store_directory_test;
      }
    } {2}

    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 {