summaryrefslogtreecommitdiffstats
path: root/test/tkt-f7b4edec.test
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 14:07:11 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 14:07:11 +0000
commit63847496f14c813a5d80efd5b7de0f1294ffe1e3 (patch)
tree01c7571c7c762ceee70638549a99834fdd7c411b /test/tkt-f7b4edec.test
parentInitial commit. (diff)
downloadsqlite3-63847496f14c813a5d80efd5b7de0f1294ffe1e3.tar.xz
sqlite3-63847496f14c813a5d80efd5b7de0f1294ffe1e3.zip
Adding upstream version 3.45.1.upstream/3.45.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/tkt-f7b4edec.test')
-rw-r--r--test/tkt-f7b4edec.test75
1 files changed, 75 insertions, 0 deletions
diff --git a/test/tkt-f7b4edec.test b/test/tkt-f7b4edec.test
new file mode 100644
index 0000000..d21da31
--- /dev/null
+++ b/test/tkt-f7b4edec.test
@@ -0,0 +1,75 @@
+# 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
+ifcapable !shared_cache { finish_test ; return }
+
+# 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