xref: /sqlite-3.40.0/test/pragma.test (revision 736c7d4b)
1cd61c281Sdrh# 2002 March 6
2cd61c281Sdrh#
3cd61c281Sdrh# The author disclaims copyright to this source code.  In place of
4cd61c281Sdrh# a legal notice, here is a blessing:
5cd61c281Sdrh#
6cd61c281Sdrh#    May you do good and not evil.
7cd61c281Sdrh#    May you find forgiveness for yourself and forgive others.
8cd61c281Sdrh#    May you share freely, never taking more than you give.
9cd61c281Sdrh#
10cd61c281Sdrh#***********************************************************************
11cd61c281Sdrh# This file implements regression tests for SQLite library.
12cd61c281Sdrh#
13cd61c281Sdrh# This file implements tests for the PRAGMA command.
14cd61c281Sdrh#
15*736c7d4bSdrh# $Id: pragma.test,v 1.45 2006/11/30 13:06:37 drh Exp $
16cd61c281Sdrh
17cd61c281Sdrhset testdir [file dirname $argv0]
18cd61c281Sdrhsource $testdir/tester.tcl
19cd61c281Sdrh
2091cf71b0Sdanielk1977# Test organization:
2191cf71b0Sdanielk1977#
2291cf71b0Sdanielk1977# pragma-1.*: Test cache_size, default_cache_size and synchronous on main db.
2391cf71b0Sdanielk1977# pragma-2.*: Test synchronous on attached db.
2491cf71b0Sdanielk1977# pragma-3.*: Test detection of table/index inconsistency by integrity_check.
2591cf71b0Sdanielk1977# pragma-4.*: Test cache_size and default_cache_size on attached db.
2691cf71b0Sdanielk1977# pragma-5.*: Test that pragma synchronous may not be used inside of a
2791cf71b0Sdanielk1977#             transaction.
28cc6bd383Sdanielk1977# pragma-6.*: Test schema-query pragmas.
29cc6bd383Sdanielk1977# pragma-7.*: Miscellaneous tests.
30cc6bd383Sdanielk1977# pragma-8.*: Test user_version and schema_version pragmas.
319a09a3caStpoindex# pragma-9.*: Test temp_store and temp_store_directory.
32cc6bd383Sdanielk1977# pragma-10.*: Test the count_changes pragma in the presence of triggers.
3348af65aeSdanielk1977# pragma-11.*: Test the collation_list pragma.
3491cf71b0Sdanielk1977#
3591cf71b0Sdanielk1977
3605a82983Sdrhifcapable !pragma {
3705a82983Sdrh  finish_test
3805a82983Sdrh  return
3905a82983Sdrh}
4005a82983Sdrh
41cd61c281Sdrh# Delete the preexisting database to avoid the special setup
42cd61c281Sdrh# that the "all.test" script does.
43cd61c281Sdrh#
44cd61c281Sdrhdb close
45cd61c281Sdrhfile delete test.db
46dddca286Sdrhsqlite3 db test.db; set DB [sqlite3_connection_pointer db]
47cd61c281Sdrh
48c7b4a44cSdanielk1977ifcapable pager_pragmas {
49cd61c281Sdrhdo_test pragma-1.1 {
50cd61c281Sdrh  execsql {
51cd61c281Sdrh    PRAGMA cache_size;
52cd61c281Sdrh    PRAGMA default_cache_size;
53cd61c281Sdrh    PRAGMA synchronous;
54cd61c281Sdrh  }
5591cf71b0Sdanielk1977} {2000 2000 2}
56cd61c281Sdrhdo_test pragma-1.2 {
57cd61c281Sdrh  execsql {
58eb43e5c7Sdrh    PRAGMA synchronous=OFF;
59cd61c281Sdrh    PRAGMA cache_size=1234;
60cd61c281Sdrh    PRAGMA cache_size;
61cd61c281Sdrh    PRAGMA default_cache_size;
62cd61c281Sdrh    PRAGMA synchronous;
63cd61c281Sdrh  }
64eb43e5c7Sdrh} {1234 2000 0}
65cd61c281Sdrhdo_test pragma-1.3 {
66cd61c281Sdrh  db close
67ef4ac8f9Sdrh  sqlite3 db test.db
68cd61c281Sdrh  execsql {
69cd61c281Sdrh    PRAGMA cache_size;
70cd61c281Sdrh    PRAGMA default_cache_size;
71cd61c281Sdrh    PRAGMA synchronous;
72cd61c281Sdrh  }
7391cf71b0Sdanielk1977} {2000 2000 2}
74cd61c281Sdrhdo_test pragma-1.4 {
75cd61c281Sdrh  execsql {
76cd61c281Sdrh    PRAGMA synchronous=OFF;
77cd61c281Sdrh    PRAGMA cache_size;
78cd61c281Sdrh    PRAGMA default_cache_size;
79cd61c281Sdrh    PRAGMA synchronous;
80cd61c281Sdrh  }
8191cf71b0Sdanielk1977} {2000 2000 0}
82cd61c281Sdrhdo_test pragma-1.5 {
83cd61c281Sdrh  execsql {
84cd61c281Sdrh    PRAGMA cache_size=4321;
85cd61c281Sdrh    PRAGMA cache_size;
86cd61c281Sdrh    PRAGMA default_cache_size;
87cd61c281Sdrh    PRAGMA synchronous;
88cd61c281Sdrh  }
8991cf71b0Sdanielk1977} {4321 2000 0}
90cd61c281Sdrhdo_test pragma-1.6 {
91cd61c281Sdrh  execsql {
92cd61c281Sdrh    PRAGMA synchronous=ON;
93cd61c281Sdrh    PRAGMA cache_size;
94cd61c281Sdrh    PRAGMA default_cache_size;
95cd61c281Sdrh    PRAGMA synchronous;
96cd61c281Sdrh  }
9791cf71b0Sdanielk1977} {4321 2000 1}
98cd61c281Sdrhdo_test pragma-1.7 {
99cd61c281Sdrh  db close
100ef4ac8f9Sdrh  sqlite3 db test.db
101cd61c281Sdrh  execsql {
102cd61c281Sdrh    PRAGMA cache_size;
103cd61c281Sdrh    PRAGMA default_cache_size;
104cd61c281Sdrh    PRAGMA synchronous;
105cd61c281Sdrh  }
10691cf71b0Sdanielk1977} {2000 2000 2}
107cd61c281Sdrhdo_test pragma-1.8 {
108cd61c281Sdrh  execsql {
109cd61c281Sdrh    PRAGMA default_cache_size=123;
110cd61c281Sdrh    PRAGMA cache_size;
111cd61c281Sdrh    PRAGMA default_cache_size;
112cd61c281Sdrh    PRAGMA synchronous;
113cd61c281Sdrh  }
11491cf71b0Sdanielk1977} {123 123 2}
115802d69a7Sdrhdo_test pragma-1.9.1 {
116cd61c281Sdrh  db close
117dddca286Sdrh  sqlite3 db test.db; set ::DB [sqlite3_connection_pointer db]
118cd61c281Sdrh  execsql {
119cd61c281Sdrh    PRAGMA cache_size;
120cd61c281Sdrh    PRAGMA default_cache_size;
121cd61c281Sdrh    PRAGMA synchronous;
122cd61c281Sdrh  }
12391cf71b0Sdanielk1977} {123 123 2}
124802d69a7Sdrhifcapable vacuum {
125802d69a7Sdrh  do_test pragma-1.9.2 {
126802d69a7Sdrh    execsql {
127802d69a7Sdrh      VACUUM;
128802d69a7Sdrh      PRAGMA cache_size;
129802d69a7Sdrh      PRAGMA default_cache_size;
130802d69a7Sdrh      PRAGMA synchronous;
131802d69a7Sdrh    }
132802d69a7Sdrh  } {123 123 2}
133802d69a7Sdrh}
13491cf71b0Sdanielk1977do_test pragma-1.10 {
1355a38705eSdrh  execsql {
1364303feedSdrh    PRAGMA synchronous=NORMAL;
1374303feedSdrh    PRAGMA cache_size;
1384303feedSdrh    PRAGMA default_cache_size;
1394303feedSdrh    PRAGMA synchronous;
1404303feedSdrh  }
14191cf71b0Sdanielk1977} {123 123 1}
14291cf71b0Sdanielk1977do_test pragma-1.11 {
1434303feedSdrh  execsql {
1444303feedSdrh    PRAGMA synchronous=FULL;
1454303feedSdrh    PRAGMA cache_size;
1464303feedSdrh    PRAGMA default_cache_size;
1474303feedSdrh    PRAGMA synchronous;
1484303feedSdrh  }
14991cf71b0Sdanielk1977} {123 123 2}
15091cf71b0Sdanielk1977do_test pragma-1.12 {
1514303feedSdrh  db close
152dddca286Sdrh  sqlite3 db test.db; set ::DB [sqlite3_connection_pointer db]
1534303feedSdrh  execsql {
1544303feedSdrh    PRAGMA cache_size;
1554303feedSdrh    PRAGMA default_cache_size;
1564303feedSdrh    PRAGMA synchronous;
1574303feedSdrh  }
15891cf71b0Sdanielk1977} {123 123 2}
15991cf71b0Sdanielk1977
1605260f7e9Sdrh# Make sure the pragma handler understands numeric values in addition
1615260f7e9Sdrh# to keywords like "off" and "full".
1625260f7e9Sdrh#
1635260f7e9Sdrhdo_test pragma-1.13 {
1645260f7e9Sdrh  execsql {
1655260f7e9Sdrh    PRAGMA synchronous=0;
1665260f7e9Sdrh    PRAGMA synchronous;
1675260f7e9Sdrh  }
1685260f7e9Sdrh} {0}
1695260f7e9Sdrhdo_test pragma-1.14 {
1705260f7e9Sdrh  execsql {
1715260f7e9Sdrh    PRAGMA synchronous=2;
1725260f7e9Sdrh    PRAGMA synchronous;
1735260f7e9Sdrh  }
1745260f7e9Sdrh} {2}
175c7b4a44cSdanielk1977} ;# ifcapable pager_pragmas
1765260f7e9Sdrh
1775260f7e9Sdrh# Test turning "flag" pragmas on and off.
1785260f7e9Sdrh#
1795260f7e9Sdrhdo_test pragma-1.15 {
1805260f7e9Sdrh  execsql {
1815260f7e9Sdrh    PRAGMA vdbe_listing=YES;
1825260f7e9Sdrh    PRAGMA vdbe_listing;
1835260f7e9Sdrh  }
1845260f7e9Sdrh} {1}
1855260f7e9Sdrhdo_test pragma-1.16 {
1865260f7e9Sdrh  execsql {
1875260f7e9Sdrh    PRAGMA vdbe_listing=NO;
1885260f7e9Sdrh    PRAGMA vdbe_listing;
1895260f7e9Sdrh  }
1905260f7e9Sdrh} {0}
1915260f7e9Sdrhdo_test pragma-1.17 {
1925260f7e9Sdrh  execsql {
1935260f7e9Sdrh    PRAGMA parser_trace=ON;
1945260f7e9Sdrh    PRAGMA parser_trace=OFF;
1955260f7e9Sdrh  }
1965260f7e9Sdrh} {}
1975260f7e9Sdrhdo_test pragma-1.18 {
1985260f7e9Sdrh  execsql {
1995260f7e9Sdrh    PRAGMA bogus = -1234;  -- Parsing of negative values
2005260f7e9Sdrh  }
2015260f7e9Sdrh} {}
2025260f7e9Sdrh
20391cf71b0Sdanielk1977# Test modifying the safety_level of an attached database.
20491cf71b0Sdanielk1977do_test pragma-2.1 {
20591cf71b0Sdanielk1977  file delete -force test2.db
20691cf71b0Sdanielk1977  file delete -force test2.db-journal
2074303feedSdrh  execsql {
20891cf71b0Sdanielk1977    ATTACH 'test2.db' AS aux;
2094303feedSdrh  }
21091cf71b0Sdanielk1977} {}
211c7b4a44cSdanielk1977ifcapable pager_pragmas {
21291cf71b0Sdanielk1977do_test pragma-2.2 {
2134303feedSdrh  execsql {
21491cf71b0Sdanielk1977    pragma aux.synchronous;
2154303feedSdrh  }
21691cf71b0Sdanielk1977} {2}
21791cf71b0Sdanielk1977do_test pragma-2.3 {
21891cf71b0Sdanielk1977  execsql {
21991cf71b0Sdanielk1977    pragma aux.synchronous = OFF;
22091cf71b0Sdanielk1977    pragma aux.synchronous;
22191cf71b0Sdanielk1977    pragma synchronous;
22291cf71b0Sdanielk1977  }
22391cf71b0Sdanielk1977} {0 2}
22491cf71b0Sdanielk1977do_test pragma-2.4 {
22591cf71b0Sdanielk1977  execsql {
22691cf71b0Sdanielk1977    pragma aux.synchronous = ON;
22791cf71b0Sdanielk1977    pragma synchronous;
22891cf71b0Sdanielk1977    pragma aux.synchronous;
22991cf71b0Sdanielk1977  }
23091cf71b0Sdanielk1977} {2 1}
231c7b4a44cSdanielk1977} ;# ifcapable pager_pragmas
2324303feedSdrh
233ed717fe3Sdrh# Construct a corrupted index and make sure the integrity_check
234ed717fe3Sdrh# pragma finds it.
235ed717fe3Sdrh#
23625d6543dSdrh# These tests won't work if the database is encrypted
23725d6543dSdrh#
238ed717fe3Sdrhdo_test pragma-3.1 {
239ed717fe3Sdrh  execsql {
240ed717fe3Sdrh    BEGIN;
241ed717fe3Sdrh    CREATE TABLE t2(a,b,c);
242ed717fe3Sdrh    CREATE INDEX i2 ON t2(a);
243ed717fe3Sdrh    INSERT INTO t2 VALUES(11,2,3);
244ed717fe3Sdrh    INSERT INTO t2 VALUES(22,3,4);
245ed717fe3Sdrh    COMMIT;
246ed717fe3Sdrh    SELECT rowid, * from t2;
247ed717fe3Sdrh  }
248ed717fe3Sdrh} {1 11 2 3 2 22 3 4}
24940e016e4Sdrhif {![sqlite3 -has-codec] && $sqlite_options(integrityck)} {
250ed717fe3Sdrh  do_test pragma-3.2 {
251ed717fe3Sdrh    set rootpage [execsql {SELECT rootpage FROM sqlite_master WHERE name='i2'}]
25296fc5fe6Sdanielk1977    set db [btree_open test.db 100 0]
253ed717fe3Sdrh    btree_begin_transaction $db
254ed717fe3Sdrh    set c [btree_cursor $db $rootpage 1]
255ed717fe3Sdrh    btree_first $c
256ed717fe3Sdrh    btree_delete $c
257ed717fe3Sdrh    btree_commit $db
258ed717fe3Sdrh    btree_close $db
259ed717fe3Sdrh    execsql {PRAGMA integrity_check}
2604be295beSdrh  } {{rowid 1 missing from index i2} {wrong # of entries in index i2}}
26125d6543dSdrh}
26291cf71b0Sdanielk1977do_test pragma-3.3 {
26391cf71b0Sdanielk1977  execsql {
26491cf71b0Sdanielk1977    DROP INDEX i2;
26591cf71b0Sdanielk1977  }
26691cf71b0Sdanielk1977} {}
26791cf71b0Sdanielk1977
26891cf71b0Sdanielk1977# Test modifying the cache_size of an attached database.
269c7b4a44cSdanielk1977ifcapable pager_pragmas {
27091cf71b0Sdanielk1977do_test pragma-4.1 {
27191cf71b0Sdanielk1977  execsql {
27291cf71b0Sdanielk1977    pragma aux.cache_size;
27391cf71b0Sdanielk1977    pragma aux.default_cache_size;
27491cf71b0Sdanielk1977  }
27591cf71b0Sdanielk1977} {2000 2000}
2761bdd9b57Sdrhdo_test pragma-4.2 {
2771bdd9b57Sdrh  execsql {
27891cf71b0Sdanielk1977    pragma aux.cache_size = 50;
27991cf71b0Sdanielk1977    pragma aux.cache_size;
28091cf71b0Sdanielk1977    pragma aux.default_cache_size;
2811bdd9b57Sdrh  }
28291cf71b0Sdanielk1977} {50 2000}
2831bdd9b57Sdrhdo_test pragma-4.3 {
2841bdd9b57Sdrh  execsql {
28591cf71b0Sdanielk1977    pragma aux.default_cache_size = 456;
28691cf71b0Sdanielk1977    pragma aux.cache_size;
28791cf71b0Sdanielk1977    pragma aux.default_cache_size;
2881bdd9b57Sdrh  }
28991cf71b0Sdanielk1977} {456 456}
2901bdd9b57Sdrhdo_test pragma-4.4 {
2911bdd9b57Sdrh  execsql {
29291cf71b0Sdanielk1977    pragma cache_size;
29391cf71b0Sdanielk1977    pragma default_cache_size;
2941bdd9b57Sdrh  }
29591cf71b0Sdanielk1977} {123 123}
2961bdd9b57Sdrhdo_test pragma-4.5 {
2971bdd9b57Sdrh  execsql {
29891cf71b0Sdanielk1977    DETACH aux;
29991cf71b0Sdanielk1977    ATTACH 'test3.db' AS aux;
30091cf71b0Sdanielk1977    pragma aux.cache_size;
30191cf71b0Sdanielk1977    pragma aux.default_cache_size;
3021bdd9b57Sdrh  }
30391cf71b0Sdanielk1977} {2000 2000}
3041bdd9b57Sdrhdo_test pragma-4.6 {
3051bdd9b57Sdrh  execsql {
30691cf71b0Sdanielk1977    DETACH aux;
30791cf71b0Sdanielk1977    ATTACH 'test2.db' AS aux;
30891cf71b0Sdanielk1977    pragma aux.cache_size;
30991cf71b0Sdanielk1977    pragma aux.default_cache_size;
3101bdd9b57Sdrh  }
31191cf71b0Sdanielk1977} {456 456}
312c7b4a44cSdanielk1977} ;# ifcapable pager_pragmas
3131bdd9b57Sdrh
31491cf71b0Sdanielk1977# Test that modifying the sync-level in the middle of a transaction is
31591cf71b0Sdanielk1977# disallowed.
316c7b4a44cSdanielk1977ifcapable pager_pragmas {
31791cf71b0Sdanielk1977do_test pragma-5.0 {
3181bdd9b57Sdrh  execsql {
31991cf71b0Sdanielk1977    pragma synchronous;
3201bdd9b57Sdrh  }
32191cf71b0Sdanielk1977} {2}
32291cf71b0Sdanielk1977do_test pragma-5.1 {
3231bdd9b57Sdrh  catchsql {
3241bdd9b57Sdrh    BEGIN;
32591cf71b0Sdanielk1977    pragma synchronous = OFF;
3261bdd9b57Sdrh  }
32791cf71b0Sdanielk1977} {1 {Safety level may not be changed inside a transaction}}
32891cf71b0Sdanielk1977do_test pragma-5.2 {
32991cf71b0Sdanielk1977  execsql {
33091cf71b0Sdanielk1977    pragma synchronous;
33191cf71b0Sdanielk1977  }
33291cf71b0Sdanielk1977} {2}
3335260f7e9Sdrhcatchsql {COMMIT;}
334c7b4a44cSdanielk1977} ;# ifcapable pager_pragmas
3355260f7e9Sdrh
3365260f7e9Sdrh# Test schema-query pragmas
3375260f7e9Sdrh#
33827188fb5Sdanielk1977ifcapable schema_pragmas {
33953c0f748Sdanielk1977ifcapable tempdb {
3405260f7e9Sdrh  do_test pragma-6.1 {
341956bc92cSdrh    set res {}
34240e016e4Sdrh    execsql {SELECT * FROM sqlite_temp_master}
3435260f7e9Sdrh    foreach {idx name file} [execsql {pragma database_list}] {
3445260f7e9Sdrh      lappend res $idx $name
3455260f7e9Sdrh    }
3465260f7e9Sdrh    set res
347a71aa001Sdrh  } {0 main 1 temp 2 aux}
34853c0f748Sdanielk1977}
3495260f7e9Sdrhdo_test pragma-6.2 {
3505260f7e9Sdrh  execsql {
3515260f7e9Sdrh    pragma table_info(t2)
3525260f7e9Sdrh  }
353bfa8b102Sdrh} {0 a {} 0 {} 0 1 b {} 0 {} 0 2 c {} 0 {} 0}
354*736c7d4bSdrhdb nullvalue <<NULL>>
355417ec638Sdrhdo_test pragma-6.2.2 {
356417ec638Sdrh  execsql {
357*736c7d4bSdrh    CREATE TABLE t5(
358*736c7d4bSdrh      a TEXT DEFAULT CURRENT_TIMESTAMP,
359*736c7d4bSdrh      b DEFAULT (5+3),
360*736c7d4bSdrh      c TEXT,
361*736c7d4bSdrh      d INTEGER DEFAULT NULL,
362*736c7d4bSdrh      e TEXT DEFAULT ''
363*736c7d4bSdrh    );
364417ec638Sdrh    PRAGMA table_info(t5);
365417ec638Sdrh  }
366*736c7d4bSdrh} {0 a TEXT 0 CURRENT_TIMESTAMP 0 1 b {} 0 5+3 0 2 c TEXT 0 <<NULL>> 0 3 d INTEGER 0 NULL 0 4 e TEXT 0 '' 0}
367*736c7d4bSdrhdb nullvalue {}
3686bf89570Sdrhifcapable {foreignkey} {
3695260f7e9Sdrh  do_test pragma-6.3 {
3705260f7e9Sdrh    execsql {
3715260f7e9Sdrh      CREATE TABLE t3(a int references t2(b), b UNIQUE);
3725260f7e9Sdrh      pragma foreign_key_list(t3);
3735260f7e9Sdrh    }
3745260f7e9Sdrh  } {0 0 t2 a b}
3755260f7e9Sdrh  do_test pragma-6.4 {
3765260f7e9Sdrh    execsql {
3775260f7e9Sdrh      pragma index_list(t3);
3785260f7e9Sdrh    }
3795260f7e9Sdrh  } {0 sqlite_autoindex_t3_1 1}
3806bf89570Sdrh}
3816bf89570Sdrhifcapable {!foreignkey} {
3826bf89570Sdrh  execsql {CREATE TABLE t3(a,b UNIQUE)}
3836bf89570Sdrh}
3845260f7e9Sdrhdo_test pragma-6.5 {
3855260f7e9Sdrh  execsql {
3865260f7e9Sdrh    CREATE INDEX t3i1 ON t3(a,b);
3875260f7e9Sdrh    pragma index_info(t3i1);
3885260f7e9Sdrh  }
3895260f7e9Sdrh} {0 0 a 1 1 b}
39027188fb5Sdanielk1977} ;# ifcapable schema_pragmas
3915260f7e9Sdrh# Miscellaneous tests
3925260f7e9Sdrh#
39327188fb5Sdanielk1977ifcapable schema_pragmas {
3945260f7e9Sdrhdo_test pragma-7.1 {
3955260f7e9Sdrh  # Make sure a pragma knows to read the schema if it needs to
3965260f7e9Sdrh  db close
3975260f7e9Sdrh  sqlite3 db test.db
3985260f7e9Sdrh  execsql {
3995260f7e9Sdrh    pragma index_list(t3);
4005260f7e9Sdrh  }
4015260f7e9Sdrh} {0 t3i1 0 1 sqlite_autoindex_t3_1 1}
40227188fb5Sdanielk1977} ;# ifcapable schema_pragmas
4036c62608fSdrhifcapable {utf16} {
4045260f7e9Sdrh  do_test pragma-7.2 {
4055260f7e9Sdrh    db close
4065260f7e9Sdrh    sqlite3 db test.db
4075260f7e9Sdrh    catchsql {
4085260f7e9Sdrh      pragma encoding=bogus;
4095260f7e9Sdrh    }
4105260f7e9Sdrh  } {1 {unsupported encoding: bogus}}
4116c62608fSdrh}
41253c0f748Sdanielk1977ifcapable tempdb {
4135260f7e9Sdrh  do_test pragma-7.3 {
4145260f7e9Sdrh    db close
4155260f7e9Sdrh    sqlite3 db test.db
4165260f7e9Sdrh    execsql {
4175260f7e9Sdrh      pragma lock_status;
4185260f7e9Sdrh    }
4195260f7e9Sdrh  } {main unlocked temp closed}
42053c0f748Sdanielk1977} else {
42153c0f748Sdanielk1977  do_test pragma-7.3 {
42253c0f748Sdanielk1977    db close
42353c0f748Sdanielk1977    sqlite3 db test.db
42453c0f748Sdanielk1977    execsql {
42553c0f748Sdanielk1977      pragma lock_status;
42653c0f748Sdanielk1977    }
42753c0f748Sdanielk1977  } {main unlocked}
42853c0f748Sdanielk1977}
4295260f7e9Sdrh
4305260f7e9Sdrh
431dae2495bSdanielk1977#----------------------------------------------------------------------
432b92b70bbSdanielk1977# Test cases pragma-8.* test the "PRAGMA schema_version" and "PRAGMA
433b92b70bbSdanielk1977# user_version" statements.
434dae2495bSdanielk1977#
435b92b70bbSdanielk1977# pragma-8.1: PRAGMA schema_version
436b92b70bbSdanielk1977# pragma-8.2: PRAGMA user_version
437dae2495bSdanielk1977#
438dae2495bSdanielk1977
43911cf9fbcSdanielk1977ifcapable schema_version {
44011cf9fbcSdanielk1977
441b92b70bbSdanielk1977# First check that we can set the schema version and then retrieve the
442dae2495bSdanielk1977# same value.
443dae2495bSdanielk1977do_test pragma-8.1.1 {
444dae2495bSdanielk1977  execsql {
445b92b70bbSdanielk1977    PRAGMA schema_version = 105;
446dae2495bSdanielk1977  }
447dae2495bSdanielk1977} {}
448dae2495bSdanielk1977do_test pragma-8.1.2 {
449dae2495bSdanielk1977  execsql {
450b92b70bbSdanielk1977    PRAGMA schema_version;
451dae2495bSdanielk1977  }
452dae2495bSdanielk1977} 105
453dae2495bSdanielk1977do_test pragma-8.1.3 {
454dae2495bSdanielk1977  execsql {
455b92b70bbSdanielk1977    PRAGMA schema_version = 106;
456dae2495bSdanielk1977  }
457dae2495bSdanielk1977} {}
458dae2495bSdanielk1977do_test pragma-8.1.4 {
459dae2495bSdanielk1977  execsql {
460b92b70bbSdanielk1977    PRAGMA schema_version;
461dae2495bSdanielk1977  }
462dae2495bSdanielk1977} 106
463dae2495bSdanielk1977
464b92b70bbSdanielk1977# Check that creating a table modifies the schema-version (this is really
465b92b70bbSdanielk1977# to verify that the value being read is in fact the schema version).
466dae2495bSdanielk1977do_test pragma-8.1.5 {
467dae2495bSdanielk1977  execsql {
468dae2495bSdanielk1977    CREATE TABLE t4(a, b, c);
469dae2495bSdanielk1977    INSERT INTO t4 VALUES(1, 2, 3);
470dae2495bSdanielk1977    SELECT * FROM t4;
471dae2495bSdanielk1977  }
472dae2495bSdanielk1977} {1 2 3}
473dae2495bSdanielk1977do_test pragma-8.1.6 {
474dae2495bSdanielk1977  execsql {
475b92b70bbSdanielk1977    PRAGMA schema_version;
476dae2495bSdanielk1977  }
477dae2495bSdanielk1977} 107
478dae2495bSdanielk1977
479dae2495bSdanielk1977# Now open a second connection to the database. Ensure that changing the
480b92b70bbSdanielk1977# schema-version using the first connection forces the second connection
481dae2495bSdanielk1977# to reload the schema. This has to be done using the C-API test functions,
482dae2495bSdanielk1977# because the TCL API accounts for SCHEMA_ERROR and retries the query.
483dae2495bSdanielk1977do_test pragma-8.1.7 {
484dddca286Sdrh  sqlite3 db2 test.db; set ::DB2 [sqlite3_connection_pointer db2]
485dae2495bSdanielk1977  execsql {
486dae2495bSdanielk1977    SELECT * FROM t4;
487dae2495bSdanielk1977  } db2
488dae2495bSdanielk1977} {1 2 3}
489dae2495bSdanielk1977do_test pragma-8.1.8 {
490dae2495bSdanielk1977  execsql {
491b92b70bbSdanielk1977    PRAGMA schema_version = 108;
492dae2495bSdanielk1977  }
493dae2495bSdanielk1977} {}
494dae2495bSdanielk1977do_test pragma-8.1.9 {
495dae2495bSdanielk1977  set ::STMT [sqlite3_prepare $::DB2 "SELECT * FROM t4" -1 DUMMY]
496dae2495bSdanielk1977  sqlite3_step $::STMT
497dae2495bSdanielk1977} SQLITE_ERROR
498dae2495bSdanielk1977do_test pragma-8.1.10 {
499dae2495bSdanielk1977  sqlite3_finalize $::STMT
500dae2495bSdanielk1977} SQLITE_SCHEMA
501dae2495bSdanielk1977
502b92b70bbSdanielk1977# Make sure the schema-version can be manipulated in an attached database.
503dae2495bSdanielk1977file delete -force test2.db
504dae2495bSdanielk1977file delete -force test2.db-journal
505dae2495bSdanielk1977do_test pragma-8.1.11 {
506dae2495bSdanielk1977  execsql {
507dae2495bSdanielk1977    ATTACH 'test2.db' AS aux;
508dae2495bSdanielk1977    CREATE TABLE aux.t1(a, b, c);
509b92b70bbSdanielk1977    PRAGMA aux.schema_version = 205;
510dae2495bSdanielk1977  }
511dae2495bSdanielk1977} {}
512dae2495bSdanielk1977do_test pragma-8.1.12 {
513dae2495bSdanielk1977  execsql {
514b92b70bbSdanielk1977    PRAGMA aux.schema_version;
515dae2495bSdanielk1977  }
516dae2495bSdanielk1977} 205
517dae2495bSdanielk1977do_test pragma-8.1.13 {
518dae2495bSdanielk1977  execsql {
519b92b70bbSdanielk1977    PRAGMA schema_version;
520dae2495bSdanielk1977  }
521dae2495bSdanielk1977} 108
522dae2495bSdanielk1977
523b92b70bbSdanielk1977# And check that modifying the schema-version in an attached database
524dae2495bSdanielk1977# forces the second connection to reload the schema.
525dae2495bSdanielk1977do_test pragma-8.1.14 {
526dddca286Sdrh  sqlite3 db2 test.db; set ::DB2 [sqlite3_connection_pointer db2]
527dae2495bSdanielk1977  execsql {
528dae2495bSdanielk1977    ATTACH 'test2.db' AS aux;
529dae2495bSdanielk1977    SELECT * FROM aux.t1;
530dae2495bSdanielk1977  } db2
531dae2495bSdanielk1977} {}
532dae2495bSdanielk1977do_test pragma-8.1.15 {
533dae2495bSdanielk1977  execsql {
534b92b70bbSdanielk1977    PRAGMA aux.schema_version = 206;
535dae2495bSdanielk1977  }
536dae2495bSdanielk1977} {}
537dae2495bSdanielk1977do_test pragma-8.1.16 {
538dae2495bSdanielk1977  set ::STMT [sqlite3_prepare $::DB2 "SELECT * FROM aux.t1" -1 DUMMY]
539dae2495bSdanielk1977  sqlite3_step $::STMT
540dae2495bSdanielk1977} SQLITE_ERROR
541dae2495bSdanielk1977do_test pragma-8.1.17 {
542dae2495bSdanielk1977  sqlite3_finalize $::STMT
543dae2495bSdanielk1977} SQLITE_SCHEMA
544dae2495bSdanielk1977do_test pragma-8.1.18 {
545dae2495bSdanielk1977  db2 close
546dae2495bSdanielk1977} {}
547dae2495bSdanielk1977
548b92b70bbSdanielk1977# Now test that the user-version can be read and written (and that we aren't
549b92b70bbSdanielk1977# accidentally manipulating the schema-version instead).
550dae2495bSdanielk1977do_test pragma-8.2.1 {
551dae2495bSdanielk1977  execsql {
552b92b70bbSdanielk1977    PRAGMA user_version;
553dae2495bSdanielk1977  }
554dae2495bSdanielk1977} {0}
555dae2495bSdanielk1977do_test pragma-8.2.2 {
556dae2495bSdanielk1977  execsql {
557b92b70bbSdanielk1977    PRAGMA user_version = 2;
558dae2495bSdanielk1977  }
559dae2495bSdanielk1977} {}
560802d69a7Sdrhdo_test pragma-8.2.3.1 {
561dae2495bSdanielk1977  execsql {
562b92b70bbSdanielk1977    PRAGMA user_version;
563dae2495bSdanielk1977  }
564dae2495bSdanielk1977} {2}
565802d69a7Sdrhdo_test pragma-8.2.3.2 {
566802d69a7Sdrh  db close
567802d69a7Sdrh  sqlite3 db test.db
568802d69a7Sdrh  execsql {
569802d69a7Sdrh    PRAGMA user_version;
570802d69a7Sdrh  }
571802d69a7Sdrh} {2}
572802d69a7Sdrhdo_test pragma-8.2.4.1 {
573dae2495bSdanielk1977  execsql {
574b92b70bbSdanielk1977    PRAGMA schema_version;
575dae2495bSdanielk1977  }
576dae2495bSdanielk1977} {108}
577802d69a7Sdrhifcapable vacuum {
578802d69a7Sdrh  do_test pragma-8.2.4.2 {
579802d69a7Sdrh    execsql {
580802d69a7Sdrh      VACUUM;
581802d69a7Sdrh      PRAGMA user_version;
582802d69a7Sdrh    }
583802d69a7Sdrh  } {2}
584802d69a7Sdrh  do_test pragma-8.2.4.3 {
585802d69a7Sdrh    execsql {
586802d69a7Sdrh      PRAGMA schema_version;
587802d69a7Sdrh    }
588802d69a7Sdrh  } {109}
589802d69a7Sdrh}
590802d69a7Sdrhdb eval {ATTACH 'test2.db' AS aux}
591dae2495bSdanielk1977
592b92b70bbSdanielk1977# Check that the user-version in the auxilary database can be manipulated (
593dae2495bSdanielk1977# and that we aren't accidentally manipulating the same in the main db).
594dae2495bSdanielk1977do_test pragma-8.2.5 {
595dae2495bSdanielk1977  execsql {
596b92b70bbSdanielk1977    PRAGMA aux.user_version;
597dae2495bSdanielk1977  }
598dae2495bSdanielk1977} {0}
599dae2495bSdanielk1977do_test pragma-8.2.6 {
600dae2495bSdanielk1977  execsql {
601b92b70bbSdanielk1977    PRAGMA aux.user_version = 3;
602dae2495bSdanielk1977  }
603dae2495bSdanielk1977} {}
604dae2495bSdanielk1977do_test pragma-8.2.7 {
605dae2495bSdanielk1977  execsql {
606b92b70bbSdanielk1977    PRAGMA aux.user_version;
607dae2495bSdanielk1977  }
608dae2495bSdanielk1977} {3}
609dae2495bSdanielk1977do_test pragma-8.2.8 {
610dae2495bSdanielk1977  execsql {
611b92b70bbSdanielk1977    PRAGMA main.user_version;
612dae2495bSdanielk1977  }
613dae2495bSdanielk1977} {2}
614dae2495bSdanielk1977
615b92b70bbSdanielk1977# Now check that a ROLLBACK resets the user-version if it has been modified
616dae2495bSdanielk1977# within a transaction.
617dae2495bSdanielk1977do_test pragma-8.2.9 {
618dae2495bSdanielk1977  execsql {
619dae2495bSdanielk1977    BEGIN;
620b92b70bbSdanielk1977    PRAGMA aux.user_version = 10;
621b92b70bbSdanielk1977    PRAGMA user_version = 11;
622dae2495bSdanielk1977  }
623dae2495bSdanielk1977} {}
624dae2495bSdanielk1977do_test pragma-8.2.10 {
625dae2495bSdanielk1977  execsql {
626b92b70bbSdanielk1977    PRAGMA aux.user_version;
627dae2495bSdanielk1977  }
628dae2495bSdanielk1977} {10}
629dae2495bSdanielk1977do_test pragma-8.2.11 {
630dae2495bSdanielk1977  execsql {
631b92b70bbSdanielk1977    PRAGMA main.user_version;
632dae2495bSdanielk1977  }
633dae2495bSdanielk1977} {11}
634dae2495bSdanielk1977do_test pragma-8.2.12 {
635dae2495bSdanielk1977  execsql {
636dae2495bSdanielk1977    ROLLBACK;
637b92b70bbSdanielk1977    PRAGMA aux.user_version;
638dae2495bSdanielk1977  }
639dae2495bSdanielk1977} {3}
640dae2495bSdanielk1977do_test pragma-8.2.13 {
641dae2495bSdanielk1977  execsql {
642b92b70bbSdanielk1977    PRAGMA main.user_version;
643dae2495bSdanielk1977  }
644dae2495bSdanielk1977} {2}
645dae2495bSdanielk1977
646b92b70bbSdanielk1977# Try a negative value for the user-version
647dae2495bSdanielk1977do_test pragma-8.2.14 {
648dae2495bSdanielk1977  execsql {
649b92b70bbSdanielk1977    PRAGMA user_version = -450;
650dae2495bSdanielk1977  }
651dae2495bSdanielk1977} {}
652dae2495bSdanielk1977do_test pragma-8.2.15 {
653dae2495bSdanielk1977  execsql {
654b92b70bbSdanielk1977    PRAGMA user_version;
655dae2495bSdanielk1977  }
656dae2495bSdanielk1977} {-450}
657d9c847dcSdanielk1977} ; # ifcapable schema_version
658d9c847dcSdanielk1977
6599a09a3caStpoindex
6609a09a3caStpoindex# Test temp_store and temp_store_directory pragmas
6619a09a3caStpoindex#
662268283bcSdrhifcapable pager_pragmas {
6639a09a3caStpoindexdo_test pragma-9.1 {
6649a09a3caStpoindex  db close
6659a09a3caStpoindex  sqlite3 db test.db
6669a09a3caStpoindex  execsql {
6679a09a3caStpoindex    PRAGMA temp_store;
6689a09a3caStpoindex  }
6699a09a3caStpoindex} {0}
6709a09a3caStpoindexdo_test pragma-9.2 {
6719a09a3caStpoindex  execsql {
6729a09a3caStpoindex    PRAGMA temp_store=file;
6739a09a3caStpoindex    PRAGMA temp_store;
6749a09a3caStpoindex  }
6759a09a3caStpoindex} {1}
6769a09a3caStpoindexdo_test pragma-9.3 {
6779a09a3caStpoindex  execsql {
6789a09a3caStpoindex    PRAGMA temp_store=memory;
6799a09a3caStpoindex    PRAGMA temp_store;
6809a09a3caStpoindex  }
6819a09a3caStpoindex} {2}
6829a09a3caStpoindexdo_test pragma-9.4 {
6839a09a3caStpoindex  execsql {
6849a09a3caStpoindex    PRAGMA temp_store_directory;
6859a09a3caStpoindex  }
6869a09a3caStpoindex} {}
6879a09a3caStpoindexdo_test pragma-9.5 {
688268283bcSdrh  set pwd [string map {' ''} [pwd]]
689268283bcSdrh  execsql "
690268283bcSdrh    PRAGMA temp_store_directory='$pwd';
6919a09a3caStpoindex  "
6929a09a3caStpoindex} {}
6939a09a3caStpoindexdo_test pragma-9.6 {
6949a09a3caStpoindex  execsql {
6959a09a3caStpoindex    PRAGMA temp_store_directory;
6969a09a3caStpoindex  }
6979a09a3caStpoindex} [pwd]
6989a09a3caStpoindexdo_test pragma-9.7 {
699268283bcSdrh  catchsql {
7009a09a3caStpoindex    PRAGMA temp_store_directory='/NON/EXISTENT/PATH/FOOBAR';
7019a09a3caStpoindex  }
702268283bcSdrh} {1 {not a writable directory}}
7039a09a3caStpoindexdo_test pragma-9.8 {
7049a09a3caStpoindex  execsql {
7059a09a3caStpoindex    PRAGMA temp_store_directory='';
7069a09a3caStpoindex  }
7079a09a3caStpoindex} {}
70853c0f748Sdanielk1977ifcapable tempdb {
7099a09a3caStpoindex  do_test pragma-9.9 {
7109a09a3caStpoindex    execsql {
7119a09a3caStpoindex      PRAGMA temp_store_directory;
7129a09a3caStpoindex      PRAGMA temp_store=FILE;
7139a09a3caStpoindex      CREATE TEMP TABLE temp_store_directory_test(a integer);
7149a09a3caStpoindex      INSERT INTO temp_store_directory_test values (2);
7159a09a3caStpoindex      SELECT * FROM temp_store_directory_test;
7169a09a3caStpoindex    }
7179a09a3caStpoindex  } {2}
71853c0f748Sdanielk1977}
7199a09a3caStpoindexdo_test pragma-9.10 {
720268283bcSdrh  catchsql "
721268283bcSdrh    PRAGMA temp_store_directory='$pwd';
7229a09a3caStpoindex    SELECT * FROM temp_store_directory_test;
7239a09a3caStpoindex  "
724268283bcSdrh} {1 {no such table: temp_store_directory_test}}
725268283bcSdrh} ;# ifcapable pager_pragmas
7269a09a3caStpoindex
727cc6bd383Sdanielk1977ifcapable trigger {
728cc6bd383Sdanielk1977
729cc6bd383Sdanielk1977do_test pragma-10.0 {
730cc6bd383Sdanielk1977  catchsql {
731cc6bd383Sdanielk1977    DROP TABLE main.t1;
732cc6bd383Sdanielk1977  }
733cc6bd383Sdanielk1977  execsql {
734cc6bd383Sdanielk1977    PRAGMA count_changes = 1;
735cc6bd383Sdanielk1977
736cc6bd383Sdanielk1977    CREATE TABLE t1(a PRIMARY KEY);
737cc6bd383Sdanielk1977    CREATE TABLE t1_mirror(a);
738cc6bd383Sdanielk1977    CREATE TABLE t1_mirror2(a);
739cc6bd383Sdanielk1977    CREATE TRIGGER t1_bi BEFORE INSERT ON t1 BEGIN
740cc6bd383Sdanielk1977      INSERT INTO t1_mirror VALUES(new.a);
741cc6bd383Sdanielk1977    END;
742cc6bd383Sdanielk1977    CREATE TRIGGER t1_ai AFTER INSERT ON t1 BEGIN
743cc6bd383Sdanielk1977      INSERT INTO t1_mirror2 VALUES(new.a);
744cc6bd383Sdanielk1977    END;
745cc6bd383Sdanielk1977    CREATE TRIGGER t1_bu BEFORE UPDATE ON t1 BEGIN
746cc6bd383Sdanielk1977      UPDATE t1_mirror SET a = new.a WHERE a = old.a;
747cc6bd383Sdanielk1977    END;
748cc6bd383Sdanielk1977    CREATE TRIGGER t1_au AFTER UPDATE ON t1 BEGIN
749cc6bd383Sdanielk1977      UPDATE t1_mirror2 SET a = new.a WHERE a = old.a;
750cc6bd383Sdanielk1977    END;
751cc6bd383Sdanielk1977    CREATE TRIGGER t1_bd BEFORE DELETE ON t1 BEGIN
752cc6bd383Sdanielk1977      DELETE FROM t1_mirror WHERE a = old.a;
753cc6bd383Sdanielk1977    END;
754cc6bd383Sdanielk1977    CREATE TRIGGER t1_ad AFTER DELETE ON t1 BEGIN
755cc6bd383Sdanielk1977      DELETE FROM t1_mirror2 WHERE a = old.a;
756cc6bd383Sdanielk1977    END;
757cc6bd383Sdanielk1977  }
758cc6bd383Sdanielk1977} {}
759cc6bd383Sdanielk1977
760cc6bd383Sdanielk1977do_test pragma-10.1 {
761cc6bd383Sdanielk1977  execsql {
762cc6bd383Sdanielk1977    INSERT INTO t1 VALUES(randstr(10,10));
763cc6bd383Sdanielk1977  }
764cc6bd383Sdanielk1977} {1}
765cc6bd383Sdanielk1977do_test pragma-10.2 {
766cc6bd383Sdanielk1977  execsql {
767cc6bd383Sdanielk1977    UPDATE t1 SET a = randstr(10,10);
768cc6bd383Sdanielk1977  }
769cc6bd383Sdanielk1977} {1}
770cc6bd383Sdanielk1977do_test pragma-10.3 {
771cc6bd383Sdanielk1977  execsql {
772cc6bd383Sdanielk1977    DELETE FROM t1;
773cc6bd383Sdanielk1977  }
774cc6bd383Sdanielk1977} {1}
775cc6bd383Sdanielk1977
776cc6bd383Sdanielk1977} ;# ifcapable trigger
777cc6bd383Sdanielk1977
77848af65aeSdanielk1977ifcapable schema_pragmas {
77948af65aeSdanielk1977  do_test pragma-11.1 {
78048af65aeSdanielk1977    execsql2 {
78148af65aeSdanielk1977      pragma collation_list;
78248af65aeSdanielk1977    }
78348af65aeSdanielk1977  } {seq 0 name NOCASE seq 1 name BINARY}
78448af65aeSdanielk1977  do_test pragma-11.2 {
78548af65aeSdanielk1977    db collate New_Collation blah...
78648af65aeSdanielk1977    execsql {
78748af65aeSdanielk1977      pragma collation_list;
78848af65aeSdanielk1977    }
78948af65aeSdanielk1977  } {0 New_Collation 1 NOCASE 2 BINARY}
79048af65aeSdanielk1977}
79148af65aeSdanielk1977
792ddfb2f03Sdanielk1977ifcapable schema_pragmas&&tempdb {
793ddfb2f03Sdanielk1977  do_test pragma-12.1 {
794ddfb2f03Sdanielk1977    sqlite3 db2 test.db
795ddfb2f03Sdanielk1977    execsql {
796ddfb2f03Sdanielk1977      PRAGMA temp.table_info('abc');
797ddfb2f03Sdanielk1977    } db2
798ddfb2f03Sdanielk1977  } {}
799ddfb2f03Sdanielk1977  db2 close
800ddfb2f03Sdanielk1977
801ddfb2f03Sdanielk1977  do_test pragma-12.2 {
802ddfb2f03Sdanielk1977    sqlite3 db2 test.db
803ddfb2f03Sdanielk1977    execsql {
804ddfb2f03Sdanielk1977      PRAGMA temp.default_cache_size = 200;
805ddfb2f03Sdanielk1977      PRAGMA temp.default_cache_size;
806ddfb2f03Sdanielk1977    } db2
807ddfb2f03Sdanielk1977  } {200}
808ddfb2f03Sdanielk1977  db2 close
809ddfb2f03Sdanielk1977
810ddfb2f03Sdanielk1977  do_test pragma-12.3 {
811ddfb2f03Sdanielk1977    sqlite3 db2 test.db
812ddfb2f03Sdanielk1977    execsql {
813ddfb2f03Sdanielk1977      PRAGMA temp.cache_size = 400;
814ddfb2f03Sdanielk1977      PRAGMA temp.cache_size;
815ddfb2f03Sdanielk1977    } db2
816ddfb2f03Sdanielk1977  } {400}
817ddfb2f03Sdanielk1977  db2 close
818ddfb2f03Sdanielk1977}
819ddfb2f03Sdanielk1977
8204b2688abSdanielk1977ifcapable bloblit {
8214b2688abSdanielk1977
82205a82983Sdrhdo_test pragma-13.1 {
82305a82983Sdrh  execsql {
82405a82983Sdrh    DROP TABLE IF EXISTS t4;
82505a82983Sdrh    PRAGMA vdbe_trace=on;
82605a82983Sdrh    PRAGMA vdbe_listing=on;
82705a82983Sdrh    PRAGMA sql_trace=on;
82805a82983Sdrh    CREATE TABLE t4(a INTEGER PRIMARY KEY,b);
82905a82983Sdrh    INSERT INTO t4(b) VALUES(x'0123456789abcdef0123456789abcdef0123456789');
83005a82983Sdrh    INSERT INTO t4(b) VALUES(randstr(30,30));
83105a82983Sdrh    INSERT INTO t4(b) VALUES(1.23456);
83205a82983Sdrh    INSERT INTO t4(b) VALUES(NULL);
83305a82983Sdrh    INSERT INTO t4(b) VALUES(0);
83405a82983Sdrh    INSERT INTO t4(b) SELECT b||b||b||b FROM t4;
83505a82983Sdrh    SELECT * FROM t4;
83605a82983Sdrh  }
83705a82983Sdrh  execsql {
83805a82983Sdrh    PRAGMA vdbe_trace=off;
83905a82983Sdrh    PRAGMA vdbe_listing=off;
84005a82983Sdrh    PRAGMA sql_trace=off;
84105a82983Sdrh  }
84205a82983Sdrh} {}
84305a82983Sdrh
8444b2688abSdanielk1977} ;# ifcapable bloblit
8454b2688abSdanielk1977
8465558a8a6Sdanielk1977# Reset the sqlite3_temp_directory variable for the next run of tests:
8475558a8a6Sdanielk1977sqlite3 dbX :memory:
8485558a8a6Sdanielk1977dbX eval {PRAGMA temp_store_directory = ""}
8495558a8a6Sdanielk1977dbX close
8505558a8a6Sdanielk1977
851cd61c281Sdrhfinish_test
852