| 1 |
# 2019 April 23 |
| 2 |
# |
| 3 |
# The author disclaims copyright to this source code. In place of |
| 4 |
# 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 |
# Tests for the SQLITE_RECOVER_ROWIDS option. |
| 13 |
# |
| 14 |
|
| 15 |
source [file join [file dirname [info script]] recover_common.tcl] |
| 16 |
set testprefix recoverclobber |
| 17 |
|
| 18 |
proc recover {db output} { |
| 19 |
set R [sqlite3_recover_init db main test.db2] |
| 20 |
$R run |
| 21 |
$R finish |
| 22 |
} |
| 23 |
|
| 24 |
forcedelete test.db2 |
| 25 |
do_execsql_test 1.0 { |
| 26 |
ATTACH 'test.db2' AS aux; |
| 27 |
CREATE TABLE aux.x1(x, one); |
| 28 |
INSERT INTO x1 VALUES(1, 'one'), (2, 'two'), (3, 'three'); |
| 29 |
|
| 30 |
CREATE TABLE t1(a, b); |
| 31 |
INSERT INTO t1 VALUES(1, 1), (2, 2), (3, 3), (4, 4); |
| 32 |
|
| 33 |
DETACH aux; |
| 34 |
} |
| 35 |
|
| 36 |
breakpoint |
| 37 |
do_test 1.1 { |
| 38 |
recover db test.db2 |
| 39 |
} {} |
| 40 |
|
| 41 |
do_execsql_test 1.2 { |
| 42 |
ATTACH 'test.db2' AS aux; |
| 43 |
SELECT * FROM aux.t1; |
| 44 |
} {1 1 2 2 3 3 4 4} |
| 45 |
|
| 46 |
do_catchsql_test 1.3 { |
| 47 |
SELECT * FROM aux.x1; |
| 48 |
} {1 {no such table: aux.x1}} |
| 49 |
|
| 50 |
finish_test |