| OLD | NEW |
| 1 # 2014 August 30 | 1 # 2014 August 30 |
| 2 # | 2 # |
| 3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
| 4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
| 5 # | 5 # |
| 6 # May you do good and not evil. | 6 # May you do good and not evil. |
| 7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
| 8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
| 9 # | 9 # |
| 10 #*********************************************************************** | 10 #*********************************************************************** |
| 11 # | 11 # |
| 12 # Test some properties of the pager_rbu_mode and rbu_mode pragmas. | 12 # Test some properties of the pager_rbu_mode and rbu_mode pragmas. |
| 13 # | 13 # |
| 14 | 14 |
| 15 if {![info exists testdir]} { | 15 source [file join [file dirname [info script]] rbu_common.tcl] |
| 16 set testdir [file join [file dirname [info script]] .. .. test] | |
| 17 } | |
| 18 source $testdir/tester.tcl | |
| 19 set ::testprefix rbu5 | 16 set ::testprefix rbu5 |
| 20 | 17 |
| 21 | 18 |
| 22 # Run the RBU in file $rbu on target database $target until completion. | |
| 23 # | |
| 24 proc run_rbu {target rbu} { | |
| 25 sqlite3rbu rbu $target $rbu | |
| 26 while { [rbu step]=="SQLITE_OK" } {} | |
| 27 rbu close | |
| 28 } | |
| 29 | |
| 30 | |
| 31 # Run the RBU in file $rbu on target database $target one step at a | |
| 32 # time until completion. | |
| 33 # | |
| 34 proc step_rbu {target rbu} { | |
| 35 while 1 { | |
| 36 sqlite3rbu rbu $target $rbu | |
| 37 set rc [rbu step] | |
| 38 rbu close | |
| 39 if {$rc != "SQLITE_OK"} break | |
| 40 } | |
| 41 set rc | |
| 42 } | |
| 43 | |
| 44 # Return a list of the primary key columns for table $tbl in the database | 19 # Return a list of the primary key columns for table $tbl in the database |
| 45 # opened by database handle $db. | 20 # opened by database handle $db. |
| 46 # | 21 # |
| 47 proc pkcols {db tbl} { | 22 proc pkcols {db tbl} { |
| 48 set ret [list] | 23 set ret [list] |
| 49 $db eval "PRAGMA table_info = '$tbl'" { | 24 $db eval "PRAGMA table_info = '$tbl'" { |
| 50 if {$pk} { lappend ret $name } | 25 if {$pk} { lappend ret $name } |
| 51 } | 26 } |
| 52 return $ret | 27 return $ret |
| 53 } | 28 } |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 db close | 297 db close |
| 323 } | 298 } |
| 324 } | 299 } |
| 325 | 300 |
| 326 | 301 |
| 327 finish_test | 302 finish_test |
| 328 | 303 |
| 329 | 304 |
| 330 | 305 |
| 331 | 306 |
| OLD | NEW |