Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/sqlite/blob/master/ext/rbu/rbubusy.test # sqlite [Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `sqlite / ext / rbu / rbubusy.test` 89 lines ยท 1599 bytes Raw Blame History 1 # 2014 August 30 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 # 13 14 source [file join [file dirname [info script]] rbu_common.tcl] 15 ifcapable !rbu { finish_test ; return } 16 if_no_rbu_support { finish_test ; return } 17 set ::testprefix rbubusy 18 19 db close 20 sqlite3_shutdown 21 test_sqlite3_log xLog 22 reset_db 23 24 set db_sql { 25 CREATE TABLE t1(a PRIMARY KEY, b, c); 26 INSERT INTO t1 VALUES(1000, 2000, 3000); 27 } 28 29 set rbu_sql { 30 CREATE TABLE data_t1(a, b, c, rbu_control); 31 INSERT INTO data_t1 VALUES(1, 2, 3, 0); 32 INSERT INTO data_t1 VALUES(4, 5, 6, 0); 33 INSERT INTO data_t1 VALUES(7, 8, 9, 0); 34 } 35 36 do_test 1.1 { 37 forcedelete rbu.db 38 sqlite3 rbu rbu.db 39 rbu eval $rbu_sql 40 rbu close 41 42 db eval $db_sql 43 } {} 44 45 do_execsql_test 1.2 { 46 BEGIN; 47 SELECT * FROM t1 48 } {1000 2000 3000} 49 50 do_test 1.3 { 51 sqlite3rbu rbu test.db rbu.db 52 rbu step 53 } {SQLITE_OK} 54 55 do_test 1.4 { 56 while 1 { 57 set rc [rbu step] 58 if {$rc!="SQLITE_OK"} break 59 } 60 set rc 61 } {SQLITE_BUSY} 62 63 do_test 1.5 { 64 rbu step 65 } {SQLITE_BUSY} 66 67 do_test 1.6 { 68 db eval COMMIT 69 rbu step 70 } {SQLITE_BUSY} 71 catch { rbu close } 72 73 do_test 1.7 { 74 sqlite3rbu rbu test.db rbu.db 75 while 1 { 76 set rc [rbu step] 77 if {$rc!="SQLITE_OK"} break 78 } 79 set rc 80 } {SQLITE_DONE} 81 82 rbu close 83 84 db close 85 sqlite3_shutdown 86 test_sqlite3_log 87 sqlite3_initialize 88 finish_test 89