SQLite

Check-in [2d1f0b923d]
Login

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

Overview
Comment:Ensure the test suite runs with SQLITE_OMIT_PAGER_PRAGMAS defined. (CVS 2145)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 2d1f0b923d3c5a669959a03a4344fddcb69c7a98
User & Date: danielk1977 2004-11-23 10:52:51.000
Context
2004-11-23
11:16
Make the test suite pass when SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS is defined. (CVS 2146) (check-in: ff20c623c6 user: danielk1977 tags: trunk)
10:52
Ensure the test suite runs with SQLITE_OMIT_PAGER_PRAGMAS defined. (CVS 2145) (check-in: 2d1f0b923d user: danielk1977 tags: trunk)
10:13
Have tests pass when SQLITE_OMIT_SCHEMA_PRAGMAS is defined. (CVS 2144) (check-in: 6ccb589bd9 user: danielk1977 tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
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
22
23
24
25
# 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.8 2004/11/10 15:27:38 danielk1977 Exp $


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








do_test pagesize-1.1 {
  execsql {PRAGMA page_size}
} 1024
ifcapable {explain} {
  do_test pagesize-1.2 {
    catch {execsql {EXPLAIN PRAGMA page_size}}













|




>
>
>
>
>
>
>







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
# 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.9 2004/11/23 10:52:51 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.
ifcapable !pager_pragmas {
  finish_test
  return
}

do_test pagesize-1.1 {
  execsql {PRAGMA page_size}
} 1024
ifcapable {explain} {
  do_test pagesize-1.2 {
    catch {execsql {EXPLAIN PRAGMA page_size}}
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.25 2004/11/23 10:13:03 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.26 2004/11/23 10:52:51 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.
30
31
32
33
34
35
36

37
38
39
40
41
42
43
# Delete the preexisting database to avoid the special setup
# that the "all.test" script does.
#
db close
file delete test.db
set DB [sqlite3 db test.db]


do_test pragma-1.1 {
  execsql {
    PRAGMA cache_size;
    PRAGMA default_cache_size;
    PRAGMA synchronous;
  }
} {2000 2000 2}







>







30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Delete the preexisting database to avoid the special setup
# that the "all.test" script does.
#
db close
file delete test.db
set DB [sqlite3 db test.db]

ifcapable pager_pragmas {
do_test pragma-1.1 {
  execsql {
    PRAGMA cache_size;
    PRAGMA default_cache_size;
    PRAGMA synchronous;
  }
} {2000 2000 2}
145
146
147
148
149
150
151

152
153
154
155
156
157
158
} {0}
do_test pragma-1.14 {
  execsql {
    PRAGMA synchronous=2;
    PRAGMA synchronous;
  }
} {2}


# Test turning "flag" pragmas on and off.
#
do_test pragma-1.15 {
  execsql {
    PRAGMA vdbe_listing=YES;
    PRAGMA vdbe_listing;







>







146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
} {0}
do_test pragma-1.14 {
  execsql {
    PRAGMA synchronous=2;
    PRAGMA synchronous;
  }
} {2}
} ;# ifcapable pager_pragmas

# Test turning "flag" pragmas on and off.
#
do_test pragma-1.15 {
  execsql {
    PRAGMA vdbe_listing=YES;
    PRAGMA vdbe_listing;
180
181
182
183
184
185
186

187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205

206
207
208
209
210
211
212
do_test pragma-2.1 {
  file delete -force test2.db
  file delete -force test2.db-journal
  execsql {
    ATTACH 'test2.db' AS aux;
  } 
} {}

do_test pragma-2.2 {
  execsql {
    pragma aux.synchronous;
  } 
} {2}
do_test pragma-2.3 {
  execsql {
    pragma aux.synchronous = OFF;
    pragma aux.synchronous;
    pragma synchronous;
  } 
} {0 2}
do_test pragma-2.4 {
  execsql {
    pragma aux.synchronous = ON;
    pragma synchronous;
    pragma aux.synchronous;
  } 
} {2 1}


# 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 {







>



















>







182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
do_test pragma-2.1 {
  file delete -force test2.db
  file delete -force test2.db-journal
  execsql {
    ATTACH 'test2.db' AS aux;
  } 
} {}
ifcapable pager_pragmas {
do_test pragma-2.2 {
  execsql {
    pragma aux.synchronous;
  } 
} {2}
do_test pragma-2.3 {
  execsql {
    pragma aux.synchronous = OFF;
    pragma aux.synchronous;
    pragma synchronous;
  } 
} {0 2}
do_test pragma-2.4 {
  execsql {
    pragma aux.synchronous = ON;
    pragma synchronous;
    pragma aux.synchronous;
  } 
} {2 1}
} ;# ifcapable pager_pragmas

# 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 {
236
237
238
239
240
241
242

243
244
245
246
247
248
249
do_test pragma-3.3 {
  execsql {
    DROP INDEX i2;
  } 
} {}

# Test modifying the cache_size of an attached database.

do_test pragma-4.1 {
  execsql {
    pragma aux.cache_size;
    pragma aux.default_cache_size;
  } 
} {2000 2000}
do_test pragma-4.2 {







>







240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
do_test pragma-3.3 {
  execsql {
    DROP INDEX i2;
  } 
} {}

# 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 {
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
  execsql {
    DETACH aux;
    ATTACH 'test2.db' AS aux;
    pragma aux.cache_size;
    pragma aux.default_cache_size;
  } 
} {456 456}


# Test that modifying the sync-level in the middle of a transaction is
# disallowed.

do_test pragma-5.0 {
  execsql {
    pragma synchronous;
  } 
} {2}
do_test pragma-5.1 {
  catchsql {
    BEGIN;
    pragma synchronous = OFF;
  } 
} {1 {Safety level may not be changed inside a transaction}}
do_test pragma-5.2 {
  execsql {
    pragma synchronous;
  } 
} {2}
catchsql {COMMIT;}


# Test schema-query pragmas
#
ifcapable schema_pragmas {
do_test pragma-6.1 {
  set res {}
  execsql {SELECT * FROM sqlite_temp_master}







>



>

















>







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
  execsql {
    DETACH aux;
    ATTACH 'test2.db' AS aux;
    pragma aux.cache_size;
    pragma aux.default_cache_size;
  } 
} {456 456}
} ;# ifcapable pager_pragmas

# Test that modifying the sync-level in the middle of a transaction is
# disallowed.
ifcapable pager_pragmas {
do_test pragma-5.0 {
  execsql {
    pragma synchronous;
  } 
} {2}
do_test pragma-5.1 {
  catchsql {
    BEGIN;
    pragma synchronous = OFF;
  } 
} {1 {Safety level may not be changed inside a transaction}}
do_test pragma-5.2 {
  execsql {
    pragma synchronous;
  } 
} {2}
catchsql {COMMIT;}
} ;# ifcapable pager_pragmas

# Test schema-query pragmas
#
ifcapable schema_pragmas {
do_test pragma-6.1 {
  set res {}
  execsql {SELECT * FROM sqlite_temp_master}