1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Modify a few test scripts to avoid leaving the sqlite3Config structure in a non-default state.

FossilOrigin-Name: 562687d9f56bf4bb0f5f07f97cbbb7649c81faf8
This commit is contained in:
dan
2015-07-24 14:17:17 +00:00
parent f6972c3764
commit 03bc525a51
11 changed files with 88 additions and 39 deletions

View File

@ -2041,6 +2041,45 @@ proc db_delete_and_reopen {{file test.db}} {
sqlite3 db $file
}
# Close any connections named [db], [db2] or [db3]. Then use sqlite3_config
# to configure the size of the PAGECACHE allocation using the parameters
# provided to this command. Save the old PAGECACHE parameters in a global
# variable so that [test_restore_config_pagecache] can restore the previous
# configuration.
#
# Before returning, reopen connection [db] on file test.db.
#
proc test_set_config_pagecache {sz nPg} {
catch {db close}
catch {db2 close}
catch {db3 close}
sqlite3_shutdown
set ::old_pagecache_config [sqlite3_config_pagecache $sz $nPg]
sqlite3_initialize
autoinstall_test_functions
sqlite3 db test.db
}
# Close any connections named [db], [db2] or [db3]. Then use sqlite3_config
# to configure the size of the PAGECACHE allocation to the size saved in
# the global variable by an earlier call to [test_set_config_pagecache].
#
# Before returning, reopen connection [db] on file test.db.
#
proc test_restore_config_pagecache {} {
catch {db close}
catch {db2 close}
catch {db3 close}
sqlite3_shutdown
eval sqlite3_config_pagecache $::old_pagecache_config
unset ::old_pagecache_config
sqlite3_initialize
autoinstall_test_functions
sqlite3 db test.db
}
# If the library is compiled with the SQLITE_DEFAULT_AUTOVACUUM macro set
# to non-zero, then set the global variable $AUTOVACUUM to 1.
set AUTOVACUUM $sqlite_options(default_autovacuum)