Have "PRAGMA quick_check" compare the number of entries in tables and indexes.
[sqlite.git] / ext / recover / recoversql.test
blob0a6726727da7f74e61b1f7bfba58999276b2b520
1 # 2022 September 13
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 #***********************************************************************
14 source [file join [file dirname [info script]] recover_common.tcl]
15 set testprefix recoversql
17 do_execsql_test 1.0 {
18   CREATE TABLE "x.1" (x, y);
19   INSERT INTO "x.1" VALUES(1, 1), (2, 2), (3, 3);
20   CREATE INDEX "i.1" ON "x.1"(y, x);
23 proc sql_hook {sql} {
24   incr ::iSqlHook
25   if {$::iSqlHook==$::sql_hook_cnt} { return 4 }
26   return 0
29 do_test 1.1 {
30   set ::sql_hook_cnt -1
31   set ::iSqlHook 0
32   set R [sqlite3_recover_init_sql db main sql_hook]
33   $R run
34   $R finish
35 } {}
37 set nSqlCall $iSqlHook
39 for {set ii 1} {$ii<$nSqlCall} {incr ii} {
40   set iSqlHook 0
41   set sql_hook_cnt $ii
42   do_test 1.$ii.a {
43     set R [sqlite3_recover_init_sql db main sql_hook]
44     $R run
45   } {1}
46   do_test 1.$ii.b {
47     list [catch { $R finish } msg] $msg
48   } {1 {callback returned an error - 4}}
52 finish_test