wasCSharpSQLite – Blame information for rev 7
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 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 | |||
20 | # Open two database connections to the same database file in |
||
21 | # shared cache mode. Create update hooks that will fire on |
||
22 | # each connection. |
||
23 | # |
||
24 | db close |
||
25 | set ::enable_shared_cache [sqlite3_enable_shared_cache 1] |
||
26 | sqlite3 db1 test.db |
||
27 | sqlite3 db2 test.db |
||
28 | unset -nocomplain HOOKS |
||
29 | set HOOKS {} |
||
30 | proc update_hook {args} { lappend ::HOOKS $args } |
||
31 | db1 update_hook update_hook |
||
32 | db2 update_hook update_hook |
||
33 | |||
34 | # Create a prepared statement |
||
35 | # |
||
36 | do_test tkt-f7b4edec-1 { |
||
37 | execsql { CREATE TABLE t1(x, y); } db1 |
||
38 | execsql { INSERT INTO t1 VALUES(1, 2) } db1 |
||
39 | set ::HOOKS |
||
40 | } {{INSERT main t1 1}} |
||
41 | |||
42 | # In the second database connection cause the schema to be reparsed |
||
43 | # without changing the schema cookie. |
||
44 | # |
||
45 | set HOOKS {} |
||
46 | do_test tkt-f7b4edec-2 { |
||
47 | execsql { |
||
48 | BEGIN; |
||
49 | DROP TABLE t1; |
||
50 | CREATE TABLE t1(x, y); |
||
51 | ROLLBACK; |
||
52 | } db2 |
||
53 | set ::HOOKS |
||
54 | } {} |
||
55 | |||
56 | # Rerun the prepared statement that was created prior to the |
||
57 | # schema reparse. Verify that the update-hook gives the correct |
||
58 | # output. |
||
59 | # |
||
60 | set HOOKS {} |
||
61 | do_test tkt-f7b4edec-3 { |
||
62 | execsql { INSERT INTO t1 VALUES(1, 2) } db1 |
||
63 | set ::HOOKS |
||
64 | } {{INSERT main t1 2}} |
||
65 | |||
66 | # Be sure to restore the original shared-cache mode setting before |
||
67 | # returning. |
||
68 | # |
||
69 | db1 close |
||
70 | db2 close |
||
71 | sqlite3_enable_shared_cache $::enable_shared_cache |
||
72 | |||
73 | |||
74 | finish_test |