3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
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.
10 #***********************************************************************
13 set testdir [file dirname $argv0]
14 source $testdir/tester.tcl
15 set testprefix backup5
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);
28 forcecopy test.db test.db2
31 INSERT INTO t1 VALUES(zeroblob(1000), zeroblob(1000));
32 INSERT INTO t1 VALUES(randomblob(1000), randomblob(1000));
38 set stmt [sqlite3_prepare_v2 db2 "SELECT * FROM t2" -1 dummy]
43 list [catch { sqlite3_backup B db2 main db main } msg] $msg
44 } {1 {sqlite3_backup_init() failed}}
48 } {destination database is in use}
52 sqlite3_backup B db2 main db main
58 list [sqlite3_step $stmt] [sqlite3_finalize $stmt]
59 } {SQLITE_ERROR SQLITE_ERROR}