Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Unified Diff: third_party/sqlite/src/test/sharedlock.test

Issue 949043002: Add //third_party/sqlite to dirs_to_snapshot, remove net_sql.patch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/sqlite/src/test/shared_err.test ('k') | third_party/sqlite/src/test/shell1.test » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/sqlite/src/test/sharedlock.test
diff --git a/third_party/sqlite/src/test/sharedlock.test b/third_party/sqlite/src/test/sharedlock.test
index 1e78eeafdf936256185197764a3c99fb69f60103..caa48f5bbd4417d63fe495252a528f042c68f326 100644
--- a/third_party/sqlite/src/test/sharedlock.test
+++ b/third_party/sqlite/src/test/sharedlock.test
@@ -13,6 +13,7 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
+set testprefix sharedlock
db close
ifcapable !shared_cache {
@@ -47,9 +48,35 @@ do_test sharedlock-1.2 {
set res
} {1 one 2 two 3 three}
+
+#-------------------------------------------------------------------------
+# Test that a write-lock is taken on a table when its entire contents
+# are deleted using the OP_Clear optimization.
+#
+foreach {tn delete_sql} {
+ 1 { DELETE FROM t2 WHERE 1 }
+ 2 { DELETE FROM t2 }
+} {
+ do_execsql_test 2.1 {
+ DROP TABLE IF EXISTS t2;
+ CREATE TABLE t2(x, y);
+ INSERT INTO t2 VALUES(1, 2);
+ INSERT INTO t2 VALUES(3, 4);
+ }
+
+ do_test 2.2 { execsql { SELECT * FROM t2 } db2 } {1 2 3 4}
+
+ do_execsql_test 2.3 " BEGIN; $delete_sql; "
+
+ do_test 2.4 {
+ catchsql { SELECT * FROM t2 } db2
+ } {1 {database table is locked: t2}}
+
+ do_execsql_test 2.5 COMMIT
+}
+
+
db close
db2 close
-
sqlite3_enable_shared_cache $::enable_shared_cache
finish_test
-
« no previous file with comments | « third_party/sqlite/src/test/shared_err.test ('k') | third_party/sqlite/src/test/shell1.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698