3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
6 # May you do good and not evil.
7 # May you find forgiveness for yourself and forgive others.
8 # May you share freely, never taking more than you give.
10 #***********************************************************************
11 # This file implements regression tests for SQLite library.
13 # This file implements tests for the PRAGMA command.
15 # $Id: pragma2.test,v 1.4 2007/10/09 08:29:33 danielk1977 Exp $
17 set testdir [file dirname $argv0]
18 source $testdir/tester.tcl
22 # pragma2-1.*: Test freelist_count pragma on the main database.
23 # pragma2-2.*: Test freelist_count pragma on an attached database.
24 # pragma2-3.*: Test trying to write to the freelist_count is a no-op.
27 ifcapable !pragma||!schema_pragmas {
32 # Delete the preexisting database to avoid the special setup
33 # that the "all.test" script does.
36 file delete test.db test.db-journal
37 file delete test3.db test3.db-journal
38 sqlite3 db test.db; set DB [sqlite3_connection_pointer db]
39 db eval {PRAGMA auto_vacuum=0}
43 PRAGMA freelist_count;
48 CREATE TABLE abc(a, b, c);
49 PRAGMA freelist_count;
55 PRAGMA freelist_count;
60 PRAGMA main.freelist_count;
64 file delete -force test2.db
65 file delete -force test2.db-journal
70 ATTACH 'test2.db' AS aux;
71 PRAGMA aux.auto_vacuum=OFF;
72 PRAGMA aux.freelist_count;
77 CREATE TABLE aux.abc(a, b, c);
78 PRAGMA aux.freelist_count;
82 set ::val [string repeat 0123456789 1000]
84 INSERT INTO aux.abc VALUES(1, 2, $::val);
85 PRAGMA aux.freelist_count;
89 expr {[file size test2.db] / 1024}
94 PRAGMA aux.freelist_count;
100 PRAGMA aux.freelist_count;
101 PRAGMA main.freelist_count;
102 PRAGMA freelist_count;
105 do_test pragma2-3.2 {
107 PRAGMA freelist_count = 500;
108 PRAGMA freelist_count;
111 do_test pragma2-3.3 {
113 PRAGMA aux.freelist_count = 500;
114 PRAGMA aux.freelist_count;