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 — sqlite/test/backup5.test at master · mackyle/sqlite Expand file tree/ Copy pathbackup5.testMore file actions 171 lines (135 loc) · 3.19 KB / Copy pathbackup5.testFile metadata and controls171 lines (135 loc) · 3.19 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 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 # 2014 November 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. # #*********************************************************************** # set testdir [file dirname $argv0] source $testdir/tester.tcl set testprefix backup5 forcedelete test2.db do_execsql_test 1.0 { CREATE TABLE t1(a, b); CREATE TABLE t2(a, b); INSERT INTO t2 VALUES(1, 1); INSERT INTO t2 VALUES(2, 2); INSERT INTO t2 VALUES(3, 3); } do_test 1.1 { forcecopy test.db test.db2 db eval { DROP TABLE t2; INSERT INTO t1 VALUES(zeroblob(1000), zeroblob(1000)); INSERT INTO t1 VALUES(randomblob(1000), randomblob(1000)); } } {} do_test 1.2 { sqlite3 db2 test.db2 set stmt [sqlite3_prepare_v2 db2 "SELECT * FROM t2" -1 dummy] sqlite3_step $stmt } {SQLITE_ROW} do_test 1.3 { list [catch { sqlite3_backup B db2 main db main } msg] $msg } {1 {sqlite3_backup_init() failed}} do_test 1.4 { sqlite3_errmsg db2 } {destination database is in use} do_test 1.5 { sqlite3_reset $stmt sqlite3_backup B db2 main db main B step 200 B finish } {SQLITE_OK} do_test 1.6 { list [sqlite3_step $stmt] [sqlite3_finalize $stmt] } {SQLITE_ERROR SQLITE_ERROR} do_test 1.7 { sqlite3_errmsg db2 } {no such table: t2} #------------------------------------------------------------------------- reset_db foreach n {test2.db test3.db test4.db test5.db test6.db test7.db test8.db} { forcedelete $n } do_execsql_test 2.0 { CREATE TABLE t1(a, b); CREATE TABLE t2(a, b); INSERT INTO t2 VALUES(1, 1); INSERT INTO t2 VALUES(2, 2); INSERT INTO t2 VALUES(3, 3); CREATE INDEX i1 ON t1(a); CREATE INDEX i2 ON t2(a); ATTACH 'test2.db' AS aux2; } sqlite3 db2 test2.db do_test 2.1 { sqlite3_backup B db2 main db main B step 1 execsql { ATTACH 'test3.db' AS aux3; ATTACH 'test4.db' AS aux4; ATTACH 'test5.db' AS aux5; ATTACH 'test6.db' AS aux6; ATTACH 'test7.db' AS aux7; ATTACH 'test8.db' AS aux8; } B step 200 B finish } {SQLITE_OK} db2 close do_execsql_test 2.2 { CREATE TABLE aux7.t3(a, b); CREATE TABLE aux7.t4(a, b); INSERT INTO t4 VALUES(1, 1); INSERT INTO t4 VALUES(2, 2); INSERT INTO t4 VALUES(3, 3); CREATE INDEX aux7.i3 ON t3(a); CREATE INDEX aux7.i4 ON t4(a); } sqlite3 db2 test2.db do_test 2.3 { sqlite3_backup B db2 main db aux7 B step 1 execsql { DETACH aux4; } B step 200 B finish } {SQLITE_OK} do_test 2.4 { sqlite3_backup B db2 main db aux7 B finish } {SQLITE_OK} db2 close #------------------------------------------------------------------------- reset_db do_execsql_test 3.0 { CREATE TABLE t1(x, y); CREATE INDEX i1 ON t1(y, x); INSERT INTO t1 VALUES(1, 2), (3, 4); } forcedelete test.db2 forcedelete test.db3 sqlite3 db2 test.db2 do_execsql_test -db db2 3.1 { ATTACH 'test.db3' AS aux; } do_test 3.2 { sqlite3_backup B db2 aux db main execsql { DETACH aux } db2 } {} do_test 3.3 { B step 1 } {SQLITE_ERROR} do_test 3.4 { sqlite3_errmsg db2 } {unknown database aux} do_test 3.5 { B finish } {SQLITE_ERROR} finish_test |
| You are visitor 01402792 — 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. |