GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — sqlcipher/test/backup4.test at master · sqlcipher/sqlcipher Expand file tree/ Copy pathbackup4.testMore file actions 108 lines (94 loc) · 2.84 KB / Copy pathbackup4.testFile metadata and controls108 lines (94 loc) · 2.84 KB 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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 # 2012 October 13 # # 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. # #*********************************************************************** # # The tests in this file verify that if an empty database (zero bytes in # size) is used as the source of a backup operation, the final destination # database is one page in size. # # The destination must consist of at least one page as truncating a # database file to zero bytes is equivalent to resetting the database # schema cookie and change counter. Doing that could cause other clients # to become confused and continue using out-of-date cache data. # set testdir [file dirname $argv0] source $testdir/tester.tcl set testprefix backup4 # The codec logic does not work for zero-length database files. A database # file must contain at least one page in order to be recognized as an # encrypted database. do_not_use_codec #------------------------------------------------------------------------- # At one point this test was failing because [db] was using an out of # date schema in test case 1.2. # do_execsql_test 1.0 { CREATE TABLE t1(x, y, UNIQUE(x, y)); INSERT INTO t1 VALUES('one', 'two'); SELECT * FROM t1 WHERE x='one'; PRAGMA integrity_check; } {one two ok} do_test 1.1 { sqlite3 db1 :memory: db1 backup test.db sqlite3 db1 test.db db1 eval { CREATE TABLE t1(x, y); INSERT INTO t1 VALUES('one', 'two'); } db1 close } {} do_execsql_test 1.2 { SELECT * FROM t1 WHERE x='one'; PRAGMA integrity_check; } {one two ok} db close forcedelete test.db forcedelete test.db2 sqlite3 db test.db #------------------------------------------------------------------------- # Test that if the source is zero bytes, the destination database # consists of a single page only. # do_execsql_test 2.1 { CREATE TABLE t1(a, b); CREATE INDEX i1 ON t1(a, b); } do_test 2.2 { file size test.db } [expr $AUTOVACUUM ? 4096 : 3072] do_test 2.3 { sqlite3 db1 test.db2 db1 backup test.db db1 close file size test.db } {1024} do_test 2.4 { file size test.db2 } 0 db close forcedelete test.db forcedelete test.db2 sqlite3 db test.db #------------------------------------------------------------------------- # Test that if the destination has a page-size larger than the implicit # page-size of the source, the final destination database still consists # of a single page. # do_execsql_test 3.1 { PRAGMA page_size = 4096; CREATE TABLE t1(a, b); CREATE INDEX i1 ON t1(a, b); } do_test 3.2 { file size test.db } [expr $AUTOVACUUM ? 16384 : 12288] do_test 3.3 { sqlite3 db1 test.db2 db1 backup test.db db1 close file size test.db } {1024} do_test 3.4 { file size test.db2 } 0 finish_test |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |