]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add experimental branch disallowing VACUUM when there are one or more active SQL... experimental
authordan <dan@noemail.net>
Fri, 24 Sep 2010 09:32:45 +0000 (09:32 +0000)
committerdan <dan@noemail.net>
Fri, 24 Sep 2010 09:32:45 +0000 (09:32 +0000)
FossilOrigin-Name: c1ebcacd9b31239aee065c64c4b4596d56dc397f

manifest
manifest.uuid
src/vacuum.c
test/vacuum2.test

index 490b12707a466975f2e228a200bf40f823891a70..bc52824b414ce90e7bd50c10a2ac2b02a4985183 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Modify\stestable\sstatement\sids\sin\sa\sfew\stest\sfiles\sto\saccount\sfor\srecent\sdocsrc\schanges.
-D 2010-09-24T08:00:11
+C Add\sexperimental\sbranch\sdisallowing\sVACUUM\swhen\sthere\sare\sone\sor\smore\sactive\sSQL\sstatements.
+D 2010-09-24T09:32:45
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in c599a15d268b1db2aeadea19df2adc3bf2eb6bee
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -224,7 +224,7 @@ F src/trigger.c b8bedb9c0084ceb51a40f54fcca2ce048c8de852
 F src/update.c 227e6cd512108b84f69421fc6c7aa1b83d60d6e0
 F src/utf.c 1baeeac91707a4df97ccc6141ec0f808278af685
 F src/util.c 5f5f4db4e799224713582bb49124827b16aa8e54
-F src/vacuum.c 241a8386727c1497eba4955933356dfba6ff8c9f
+F src/vacuum.c 924bd1bcee2dfb05376f79845bd3b4cec7b54b2f
 F src/vdbe.c 1373d40f5985577a30350bfa78ebd8e1d905ee89
 F src/vdbe.h 4de0efb4b0fdaaa900cf419b35c458933ef1c6d2
 F src/vdbeInt.h a247bd5448039e83394bf4179975b2ae0092874c
@@ -778,7 +778,7 @@ F test/unique.test 083c7fff74695bcc27a71d75699deba3595bc9c2
 F test/update.test 8bc86fd7ef1a00014f76dc6a6a7c974df4aef172
 F test/utf16align.test 54cd35a27c005a9b6e7815d887718780b6a462ae
 F test/vacuum.test 15ae6784e70428b8db64e95c92d84b19e507b719
-F test/vacuum2.test ec57f21d394b7b72249b11f8e4b5d487bab56539
+F test/vacuum2.test 2165164ed2463816e8c4648d0a779a863ce1a76c
 F test/vacuum3.test f39ad1428347c5808cd2da7578c470f186a4d0ce
 F test/vacuum4.test d3f8ecff345f166911568f397d2432c16d2867d9
 F test/varint.test ab7b110089a08b9926ed7390e7e97bdefeb74102
@@ -863,7 +863,10 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P fab3b383bb2c4764a56811f22ff4c783441918e8
-R 4683e99a104ba4aaae84fe720a6691d9
+P 7893e525953da6c97eaea23fe94d26e1e635edea
+R 8fb8324a0195376ff3817c4a92466767
+T *branch * experimental
+T *sym-experimental *
+T -sym-trunk *
 U dan
-Z 37fa86056d8a38c1bc8ef7e03a743aec
+Z 23cdc7ff7ef6c793433c9a44dd319415
index c1ec2a97f961a1095d1efa02c26fe65394e70206..7f2db2319959e87a9ffb16006f262af1540f8cd1 100644 (file)
@@ -1 +1 @@
-7893e525953da6c97eaea23fe94d26e1e635edea
\ No newline at end of file
+c1ebcacd9b31239aee065c64c4b4596d56dc397f
\ No newline at end of file
index a0bf1ebfe449ce434e172a74622b20864f1d532a..4babf5b4098946e86da836c27e896a79b47c067e 100644 (file)
@@ -110,6 +110,10 @@ int sqlite3RunVacuum(char **pzErrMsg, sqlite3 *db){
     sqlite3SetString(pzErrMsg, db, "cannot VACUUM from within a transaction");
     return SQLITE_ERROR;
   }
+  if( db->activeVdbeCnt>1 ){
+    sqlite3SetString(pzErrMsg, db,"cannot VACUUM - SQL statements in progress");
+    return SQLITE_ERROR;
+  }
 
   /* Save the current value of the database flags so that it can be 
   ** restored before returning. Then set the writable-schema flag, and
index 3cd6165366e157fc06642b2c35439fa1ad121036..1a054cc66bdde5401b47a6f3817bd3f98d87e050 100644 (file)
@@ -182,4 +182,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