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/test/tkt-f7b4edec.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 / test / tkt-f7b4edec.test` 75 lines ยท 1911 bytes Raw Blame History 1 # 2011 March 18 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 # This file implements regression tests for SQLite library. 12 # 13 # This file implements tests to verify that ticket 14 # [`f7b4edece25c994857dc139207f55a53c8319fae`] has been fixed. 15 # 16 17 set testdir [file dirname $argv0] 18 source $testdir/tester.tcl 19 ifcapable !shared_cache { finish_test ; return } 20 21 # Open two database connections to the same database file in 22 # shared cache mode. Create update hooks that will fire on 23 # each connection. 24 # 25 db close 26 set ::enable_shared_cache [sqlite3_enable_shared_cache 1] 27 sqlite3 db1 test.db 28 sqlite3 db2 test.db 29 unset -nocomplain HOOKS 30 set HOOKS {} 31 proc update_hook {args} { lappend ::HOOKS $args } 32 db1 update_hook update_hook 33 db2 update_hook update_hook 34 35 # Create a prepared statement 36 # 37 do_test tkt-`f7b4edec`-1 { 38 execsql { CREATE TABLE t1(x, y); } db1 39 execsql { INSERT INTO t1 VALUES(1, 2) } db1 40 set ::HOOKS 41 } {{INSERT main t1 1}} 42 43 # In the second database connection cause the schema to be reparsed 44 # without changing the schema cookie. 45 # 46 set HOOKS {} 47 do_test tkt-`f7b4edec`-2 { 48 execsql { 49 BEGIN; 50 DROP TABLE t1; 51 CREATE TABLE t1(x, y); 52 ROLLBACK; 53 } db2 54 set ::HOOKS 55 } {} 56 57 # Rerun the prepared statement that was created prior to the 58 # schema reparse. Verify that the update-hook gives the correct 59 # output. 60 # 61 set HOOKS {} 62 do_test tkt-`f7b4edec`-3 { 63 execsql { INSERT INTO t1 VALUES(1, 2) } db1 64 set ::HOOKS 65 } {{INSERT main t1 2}} 66 67 # Be sure to restore the original shared-cache mode setting before 68 # returning. 69 # 70 db1 close 71 db2 close 72 sqlite3_enable_shared_cache $::enable_shared_cache 73 74 75 finish_test