⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 incrvacuum2.test

📁 sqlite-3.4.1,嵌入式数据库.是一个功能强大的开源数据库,给学习和研发以及小型公司的发展带来了全所未有的好处.
💻 TEST
字号:
# 2007 May 04## 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.  The# focus of this file is testing the incremental vacuum feature.## $Id: incrvacuum2.test,v 1.3 2007/05/17 06:44:28 danielk1977 Exp $set testdir [file dirname $argv0]source $testdir/tester.tcl# If this build of the library does not support auto-vacuum, omit this# whole file.ifcapable {!autovacuum || !pragma} {  finish_test  return}# If the OMIT_INCRBLOB symbol was defined at compile time, there# is no zeroblob() function available. So create a similar# function here using Tcl. It doesn't return a blob, but it returns# data of the required length, which is good enough for this# test file.ifcapable !incrblob {  proc zeroblob {n} { string repeat 0 $n }  db function zeroblob zeroblob}# Create a database in incremental vacuum mode that has many# pages on the freelist.#do_test incrvacuum2-1.1 {  execsql {    PRAGMA page_size=1024;    PRAGMA auto_vacuum=incremental;    CREATE TABLE t1(x);    INSERT INTO t1 VALUES(zeroblob(30000));    DELETE FROM t1;  }  file size test.db} {32768}# Vacuum off a single page.#do_test incrvacuum2-1.2 {  execsql {    PRAGMA incremental_vacuum(1);  }  file size test.db} {31744}# Vacuum off five pages#do_test incrvacuum2-1.3 {  execsql {    PRAGMA incremental_vacuum(5);  }  file size test.db} {26624}# Vacuum off all the rest#do_test incrvacuum2-1.4 {  execsql {    PRAGMA incremental_vacuum(1000);  }  file size test.db} {3072}# Make sure incremental vacuum works on attached databases.#do_test incrvacuum2-2.1 {  file delete -force test2.db test2.db-journal  execsql {    ATTACH DATABASE 'test2.db' AS aux;    PRAGMA aux.auto_vacuum=incremental;    CREATE TABLE aux.t2(x);    INSERT INTO t2 VALUES(zeroblob(30000));    INSERT INTO t1 SELECT * FROM t2;    DELETE FROM t2;    DELETE FROM t1;  }  list [file size test.db] [file size test2.db]} {32768 32768}do_test incrvacuum2-2.2 {  execsql {    PRAGMA aux.incremental_vacuum(1)  }  list [file size test.db] [file size test2.db]} {32768 31744}do_test incrvacuum2-2.3 {  execsql {    PRAGMA aux.incremental_vacuum(5)  }  list [file size test.db] [file size test2.db]} {32768 26624}do_test incrvacuum2-2.4 {  execsql {    PRAGMA main.incremental_vacuum(5)  }  list [file size test.db] [file size test2.db]} {27648 26624}do_test incrvacuum2-2.5 {  execsql {    PRAGMA aux.incremental_vacuum  }  list [file size test.db] [file size test2.db]} {27648 3072}do_test incrvacuum2-2.6 {  execsql {    PRAGMA incremental_vacuum(1)  }  list [file size test.db] [file size test2.db]} {26624 3072} finish_test

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -