CoolFace
Modelpublic

AryaWu/sqlite

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
backup5.test66 linesDownload Raw Back to test
1# 2014 November 132#3# The author disclaims copyright to this source code.  In place of4# a legal notice, here is a blessing:5#6#    May you do good and not evil.7#    May you find forgiveness for yourself and forgive others.8#    May you share freely, never taking more than you give.9#10#***********************************************************************11#12 13set testdir [file dirname $argv0]14source $testdir/tester.tcl15set testprefix backup516 17forcedelete test2.db18 19do_execsql_test 1.0 {20  CREATE TABLE t1(a, b);21  CREATE TABLE t2(a, b);22  INSERT INTO t2 VALUES(1, 1);23  INSERT INTO t2 VALUES(2, 2);24  INSERT INTO t2 VALUES(3, 3);25}26 27do_test 1.1 {28  forcecopy test.db test.db229  db eval {30    DROP TABLE t2;31    INSERT INTO t1 VALUES(zeroblob(1000), zeroblob(1000));32    INSERT INTO t1 VALUES(randomblob(1000), randomblob(1000));33  }34} {}35 36do_test 1.2 {37  sqlite3 db2 test.db238  set stmt [sqlite3_prepare_v2 db2 "SELECT * FROM t2" -1 dummy]39  sqlite3_step $stmt40} {SQLITE_ROW}41 42do_test 1.3 {43  list [catch { sqlite3_backup B db2 main db main } msg] $msg44} {1 {sqlite3_backup_init() failed}}45 46do_test 1.4 {47  sqlite3_errmsg db248} {destination database is in use}49 50do_test 1.5 {51  sqlite3_reset $stmt52  sqlite3_backup B db2 main db main53  B step 20054  B finish55} {SQLITE_OK}56 57do_test 1.6 {58  list [sqlite3_step $stmt] [sqlite3_finalize $stmt]59} {SQLITE_ERROR SQLITE_ERROR}60 61do_test 1.7 {62  sqlite3_errmsg db263} {no such table: t2}64 65finish_test66