Index: third_party/sqlite/src/test/tkt-f7b4edec.test |
diff --git a/third_party/sqlite/src/test/tkt-f7b4edec.test b/third_party/sqlite/src/test/tkt-f7b4edec.test |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f6d3d5b95a51d0c635577838020c678366cbdfbf |
--- /dev/null |
+++ b/third_party/sqlite/src/test/tkt-f7b4edec.test |
@@ -0,0 +1,74 @@ |
+# 2011 March 18 |
+# |
+# The author disclaims copyright to this source code. In place of |
+# a legal notice, here is a blessing: |
+# |
+# May you do good and not evil. |
+# May you find forgiveness for yourself and forgive others. |
+# May you share freely, never taking more than you give. |
+# |
+#*********************************************************************** |
+# This file implements regression tests for SQLite library. |
+# |
+# This file implements tests to verify that ticket |
+# [f7b4edece25c994857dc139207f55a53c8319fae] has been fixed. |
+# |
+ |
+set testdir [file dirname $argv0] |
+source $testdir/tester.tcl |
+ |
+# Open two database connections to the same database file in |
+# shared cache mode. Create update hooks that will fire on |
+# each connection. |
+# |
+db close |
+set ::enable_shared_cache [sqlite3_enable_shared_cache 1] |
+sqlite3 db1 test.db |
+sqlite3 db2 test.db |
+unset -nocomplain HOOKS |
+set HOOKS {} |
+proc update_hook {args} { lappend ::HOOKS $args } |
+db1 update_hook update_hook |
+db2 update_hook update_hook |
+ |
+# Create a prepared statement |
+# |
+do_test tkt-f7b4edec-1 { |
+ execsql { CREATE TABLE t1(x, y); } db1 |
+ execsql { INSERT INTO t1 VALUES(1, 2) } db1 |
+ set ::HOOKS |
+} {{INSERT main t1 1}} |
+ |
+# In the second database connection cause the schema to be reparsed |
+# without changing the schema cookie. |
+# |
+set HOOKS {} |
+do_test tkt-f7b4edec-2 { |
+ execsql { |
+ BEGIN; |
+ DROP TABLE t1; |
+ CREATE TABLE t1(x, y); |
+ ROLLBACK; |
+ } db2 |
+ set ::HOOKS |
+} {} |
+ |
+# Rerun the prepared statement that was created prior to the |
+# schema reparse. Verify that the update-hook gives the correct |
+# output. |
+# |
+set HOOKS {} |
+do_test tkt-f7b4edec-3 { |
+ execsql { INSERT INTO t1 VALUES(1, 2) } db1 |
+ set ::HOOKS |
+} {{INSERT main t1 2}} |
+ |
+# Be sure to restore the original shared-cache mode setting before |
+# returning. |
+# |
+db1 close |
+db2 close |
+sqlite3_enable_shared_cache $::enable_shared_cache |
+ |
+ |
+finish_test |