xref: /sqlite-3.40.0/test/pragma.test (revision cd61c281)
1*cd61c281Sdrh# 2002 March 6
2*cd61c281Sdrh#
3*cd61c281Sdrh# The author disclaims copyright to this source code.  In place of
4*cd61c281Sdrh# a legal notice, here is a blessing:
5*cd61c281Sdrh#
6*cd61c281Sdrh#    May you do good and not evil.
7*cd61c281Sdrh#    May you find forgiveness for yourself and forgive others.
8*cd61c281Sdrh#    May you share freely, never taking more than you give.
9*cd61c281Sdrh#
10*cd61c281Sdrh#***********************************************************************
11*cd61c281Sdrh# This file implements regression tests for SQLite library.
12*cd61c281Sdrh#
13*cd61c281Sdrh# This file implements tests for the PRAGMA command.
14*cd61c281Sdrh#
15*cd61c281Sdrh# $Id: pragma.test,v 1.1 2002/03/06 22:01:37 drh Exp $
16*cd61c281Sdrh
17*cd61c281Sdrhset testdir [file dirname $argv0]
18*cd61c281Sdrhsource $testdir/tester.tcl
19*cd61c281Sdrh
20*cd61c281Sdrh# Delete the preexisting database to avoid the special setup
21*cd61c281Sdrh# that the "all.test" script does.
22*cd61c281Sdrh#
23*cd61c281Sdrhdb close
24*cd61c281Sdrhfile delete test.db
25*cd61c281Sdrhsqlite db test.db
26*cd61c281Sdrh
27*cd61c281Sdrhdo_test pragma-1.1 {
28*cd61c281Sdrh  execsql {
29*cd61c281Sdrh    PRAGMA cache_size;
30*cd61c281Sdrh    PRAGMA default_cache_size;
31*cd61c281Sdrh    PRAGMA synchronous;
32*cd61c281Sdrh    PRAGMA default_synchronous;
33*cd61c281Sdrh  }
34*cd61c281Sdrh} {2000 2000 1 1}
35*cd61c281Sdrhdo_test pragma-1.2 {
36*cd61c281Sdrh  execsql {
37*cd61c281Sdrh    PRAGMA cache_size=1234;
38*cd61c281Sdrh    PRAGMA cache_size;
39*cd61c281Sdrh    PRAGMA default_cache_size;
40*cd61c281Sdrh    PRAGMA synchronous;
41*cd61c281Sdrh    PRAGMA default_synchronous;
42*cd61c281Sdrh  }
43*cd61c281Sdrh} {1234 2000 1 1}
44*cd61c281Sdrhdo_test pragma-1.3 {
45*cd61c281Sdrh  db close
46*cd61c281Sdrh  sqlite db test.db
47*cd61c281Sdrh  execsql {
48*cd61c281Sdrh    PRAGMA cache_size;
49*cd61c281Sdrh    PRAGMA default_cache_size;
50*cd61c281Sdrh    PRAGMA synchronous;
51*cd61c281Sdrh    PRAGMA default_synchronous;
52*cd61c281Sdrh  }
53*cd61c281Sdrh} {2000 2000 1 1}
54*cd61c281Sdrhdo_test pragma-1.4 {
55*cd61c281Sdrh  execsql {
56*cd61c281Sdrh    PRAGMA synchronous=OFF;
57*cd61c281Sdrh    PRAGMA cache_size;
58*cd61c281Sdrh    PRAGMA default_cache_size;
59*cd61c281Sdrh    PRAGMA synchronous;
60*cd61c281Sdrh    PRAGMA default_synchronous;
61*cd61c281Sdrh  }
62*cd61c281Sdrh} {2000 2000 0 1}
63*cd61c281Sdrhdo_test pragma-1.5 {
64*cd61c281Sdrh  execsql {
65*cd61c281Sdrh    PRAGMA cache_size=4321;
66*cd61c281Sdrh    PRAGMA cache_size;
67*cd61c281Sdrh    PRAGMA default_cache_size;
68*cd61c281Sdrh    PRAGMA synchronous;
69*cd61c281Sdrh    PRAGMA default_synchronous;
70*cd61c281Sdrh  }
71*cd61c281Sdrh} {4321 2000 0 1}
72*cd61c281Sdrhdo_test pragma-1.6 {
73*cd61c281Sdrh  execsql {
74*cd61c281Sdrh    PRAGMA synchronous=ON;
75*cd61c281Sdrh    PRAGMA cache_size;
76*cd61c281Sdrh    PRAGMA default_cache_size;
77*cd61c281Sdrh    PRAGMA synchronous;
78*cd61c281Sdrh    PRAGMA default_synchronous;
79*cd61c281Sdrh  }
80*cd61c281Sdrh} {4321 2000 1 1}
81*cd61c281Sdrhdo_test pragma-1.7 {
82*cd61c281Sdrh  db close
83*cd61c281Sdrh  sqlite db test.db
84*cd61c281Sdrh  execsql {
85*cd61c281Sdrh    PRAGMA cache_size;
86*cd61c281Sdrh    PRAGMA default_cache_size;
87*cd61c281Sdrh    PRAGMA synchronous;
88*cd61c281Sdrh    PRAGMA default_synchronous;
89*cd61c281Sdrh  }
90*cd61c281Sdrh} {2000 2000 1 1}
91*cd61c281Sdrhdo_test pragma-1.8 {
92*cd61c281Sdrh  execsql {
93*cd61c281Sdrh    PRAGMA default_synchronous=OFF;
94*cd61c281Sdrh    PRAGMA cache_size;
95*cd61c281Sdrh    PRAGMA default_cache_size;
96*cd61c281Sdrh    PRAGMA synchronous;
97*cd61c281Sdrh    PRAGMA default_synchronous;
98*cd61c281Sdrh  }
99*cd61c281Sdrh} {2000 2000 0 0}
100*cd61c281Sdrhdo_test pragma-1.9 {
101*cd61c281Sdrh  execsql {
102*cd61c281Sdrh    PRAGMA default_cache_size=123;
103*cd61c281Sdrh    PRAGMA cache_size;
104*cd61c281Sdrh    PRAGMA default_cache_size;
105*cd61c281Sdrh    PRAGMA synchronous;
106*cd61c281Sdrh    PRAGMA default_synchronous;
107*cd61c281Sdrh  }
108*cd61c281Sdrh} {123 123 0 0}
109*cd61c281Sdrhdo_test pragma-1.10 {
110*cd61c281Sdrh  db close
111*cd61c281Sdrh  sqlite db test.db
112*cd61c281Sdrh  execsql {
113*cd61c281Sdrh    PRAGMA cache_size;
114*cd61c281Sdrh    PRAGMA default_cache_size;
115*cd61c281Sdrh    PRAGMA synchronous;
116*cd61c281Sdrh    PRAGMA default_synchronous;
117*cd61c281Sdrh  }
118*cd61c281Sdrh} {123 123 0 0}
119*cd61c281Sdrh
120*cd61c281Sdrhfinish_test
121