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

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

Issue 6990047: Import SQLite 3.7.6.3. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 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/vacuum.test ('k') | third_party/sqlite/src/test/vacuum4.test » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/sqlite/src/test/vacuum2.test
diff --git a/third_party/sqlite/src/test/vacuum2.test b/third_party/sqlite/src/test/vacuum2.test
index 3cd6165366e157fc06642b2c35439fa1ad121036..35524bb26c2d4b76d87fe28aa9a98833f3a7eb75 100644
--- a/third_party/sqlite/src/test/vacuum2.test
+++ b/third_party/sqlite/src/test/vacuum2.test
@@ -16,6 +16,11 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
+# Do not use a codec for tests in this file, as the database file is
+# manipulated directly using tcl scripts (using the [hexio_write] command).
+#
+do_not_use_codec
+
# If the VACUUM statement is disabled in the current build, skip all
# the tests in this file.
#
@@ -182,4 +187,45 @@ ifcapable autovacuum {
} {2}
}
+
+#-------------------------------------------------------------------------
+# The following block of tests verify the behaviour of the library when
+# a database is VACUUMed when there are one or more unfinalized SQL
+# statements reading the same database using the same db handle.
+#
+db close
+forcedelete test.db
+sqlite3 db test.db
+do_execsql_test vacuum2-5.1 {
+ CREATE TABLE t1(a PRIMARY KEY, b UNIQUE);
+ INSERT INTO t1 VALUES(1, randomblob(500));
+ INSERT INTO t1 SELECT a+1, randomblob(500) FROM t1; -- 2
+ INSERT INTO t1 SELECT a+2, randomblob(500) FROM t1; -- 4
+ INSERT INTO t1 SELECT a+4, randomblob(500) FROM t1; -- 8
+ INSERT INTO t1 SELECT a+8, randomblob(500) FROM t1; -- 16
+} {}
+
+do_test vacuum2-5.2 {
+ list [catch {
+ db eval {SELECT a, b FROM t1} { if {$a == 8} { execsql VACUUM } }
+ } msg] $msg
+} {1 {cannot VACUUM - SQL statements in progress}}
+
+do_test vacuum2-5.3 {
+ list [catch {
+ db eval {SELECT 1, 2, 3} { execsql VACUUM }
+ } msg] $msg
+} {1 {cannot VACUUM - SQL statements in progress}}
+
+do_test vacuum2-5.4 {
+ set res ""
+ set res2 ""
+ db eval {SELECT a, b FROM t1 WHERE a<=10} {
+ if {$a==6} { set res [catchsql VACUUM] }
+ lappend res2 $a
+ }
+ lappend res2 $res
+} {1 2 3 4 5 6 7 8 9 10 {1 {cannot VACUUM - SQL statements in progress}}}
+
+
finish_test
« no previous file with comments | « third_party/sqlite/src/test/vacuum.test ('k') | third_party/sqlite/src/test/vacuum4.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698