]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix tests in fordelete.test to test for the BTREE_AUXDELETE flag.
authordan <dan@noemail.net>
Wed, 27 Jan 2016 16:17:41 +0000 (16:17 +0000)
committerdan <dan@noemail.net>
Wed, 27 Jan 2016 16:17:41 +0000 (16:17 +0000)
FossilOrigin-Name: bbd25cf179df5bda1fe729928d6746248f06e46f

manifest
manifest.uuid
test/fordelete.test

index bf4b14906ccb6a4f3c5141a88a2b91b21018abc2..dfebd3f6ae8328973780425a85fe46d85fa33f5d 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\sassert()\sstatements\son\sthe\snExtraDelete\svariable\sin\svdbe.c\sto\stry\sto\sverify\nthat\sthe\sFORDELETE\sand\sIDXDELETE\sflags\sare\sbeing\sgenerated\scorrectly.\s\sThose\nflags\sare\snot\scurrently\sgenerated\scorrectly,\sand\sso\sthe\sassert()s\strip\son\sthis\ncheck-in.
-D 2016-01-27T15:49:32.327
+C Fix\stests\sin\sfordelete.test\sto\stest\sfor\sthe\sBTREE_AUXDELETE\sflag.
+D 2016-01-27T16:17:41.726
 F Makefile.in 027c1603f255390c43a426671055a31c0a65fdb4
 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
 F Makefile.msc 6fca5455aaecbd14479f33f091aa19df2d3d2969
@@ -642,7 +642,7 @@ F test/fkey6.test abb59f866c1b44926fd02d1fdd217d831fe04f48
 F test/fkey7.test 72e915890ee4a005daaf3002cb208e8fe973ac13
 F test/fkey8.test 8f08203458321e6c19a263829de4cfc936274ab0
 F test/fkey_malloc.test 594a7ea1fbab553c036c70813cd8bd9407d63749
-F test/fordelete.test ba12ec1d27cc34a4c23db4446029126d773f3849
+F test/fordelete.test f794392f1768584609fa439f7528484dc04d3a03
 F test/format4.test 1f0cac8ff3895e9359ed87e41aaabee982a812eb
 F test/fts-9fd058691.test 78b887e30ae6816df0e1fed6259de4b5a64ad33c
 F test/fts1a.test 46090311f85da51bb33bd5ce84f7948359c6d8d7
@@ -1422,10 +1422,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 9a71d56dcea953cb965f1fdda9a8b8f158cdeff6
-R 3af2d64e2a860c6e0d1b5193b911b983
-T *branch * fordelete-assert
-T *sym-fordelete-assert *
-T -sym-btree-fordelete-flag *
-U drh
-Z f5e1f3160ce620e13f32c1dda67a1107
+P dde1db0dd2e2cf04706117629756c352b178ebb8
+R 112344660260002964aa8c335bb07305
+U dan
+Z e0043c886092534757bb67db359c02f9
index beafd3f9d6b47f4e8b5ad2a13b20f065a1ea114f..2b4460a277444e110e253607c17d286fb3f24d2c 100644 (file)
@@ -1 +1 @@
-dde1db0dd2e2cf04706117629756c352b178ebb8
\ No newline at end of file
+bbd25cf179df5bda1fe729928d6746248f06e46f
\ No newline at end of file
index 1e860e8867cc26c9a7c55290fa03a982a17fb81a..7a49b5cbfd7a1314daeee5870f2664d731bdafb3 100644 (file)
@@ -30,17 +30,49 @@ proc analyze_delete_program {sql} {
   } {
     set T($rootpage) $name
   }
+  
+  # For each OpenWrite instruction generated for the proposed DELETE
+  # statement, add the following array entries:
+  #
+  #   $M(<cursor number>) -> <object name>
+  #   $O(<object name>)   -> "*" | ""
+  #
+  # The O() entry is set to "*" if the BTREE_FORDELETE flag is specified,
+  # or "" otherwise.
+  #
+  db eval "EXPLAIN $sql" R {
+    if {$R(opcode)=="OpenWrite"} {
+      set root $R(p2)
+      set csr $R(p1)
+      if {[info exists T($root)]} { set M($csr) $T($root) }
+
+      set obj $T($root)
+      set O($obj) ""
+      if {"0x$R(p5)" & 0x08} { 
+        set O($obj) *
+      } else {
+        set O($obj) ""
+      }
+    }
+  }
 
-  # Calculate the results.
-  set res [list]
   db eval "EXPLAIN $sql" R {
-    if {$R(opcode) == "OpenWrite"} {
-      set obj $T($R(p2))
-      if {"0x$R(p5)" & 0x08} { append obj *}
-      lappend res $obj
+    if {$R(opcode) == "Delete"} {
+      set csr $R(p1)
+      if {[info exists M($csr)]} {
+        set idxdelete [expr {("0x$R(p5)" & 0x04) ? 1 : 0}]
+        if {$idxdelete} {
+          append O($M($csr)) "+"
+        }
+      }
     }
   }
 
+  set res [list]
+  foreach {k v} [array get O] {
+    lappend res "${k}${v}"
+  }
+
   lsort $res
 }
 
@@ -53,10 +85,10 @@ do_execsql_test 1.0 {
 }
 
 foreach {tn sql res} {
-  1 { DELETE FROM t1 WHERE a=?}          { sqlite_autoindex_t1_1  t1* }
-  2 { DELETE FROM t1 WHERE a=? AND b=? } { sqlite_autoindex_t1_1  t1 }
-  3 { DELETE FROM t1 WHERE a>? }         { sqlite_autoindex_t1_1  t1* }
-  4 { DELETE FROM t1 WHERE rowid=? }     { sqlite_autoindex_t1_1*  t1 }
+  1 { DELETE FROM t1 WHERE a=?}          { sqlite_autoindex_t1_1  t1*+ }
+  2 { DELETE FROM t1 WHERE a=? AND b=? } { sqlite_autoindex_t1_1  t1 }
+  3 { DELETE FROM t1 WHERE a>? }         { sqlite_autoindex_t1_1  t1*+ }
+  4 { DELETE FROM t1 WHERE rowid=? }     { sqlite_autoindex_t1_1*  t1  }
 } {
   do_adp_test 1.$tn $sql $res
 }
@@ -68,8 +100,8 @@ do_execsql_test 2.0 {
   CREATE INDEX t2c ON t2(c);
 }
 foreach {tn sql res} {
-  1 { DELETE FROM t2 WHERE a=?}          { t2* t2a t2b* t2c* }
-  2 { DELETE FROM t2 WHERE a=? AND +b=?} { t2 t2a t2b* t2c* }
+  1 { DELETE FROM t2 WHERE a=?}          { t2*+ t2a t2b* t2c* }
+  2 { DELETE FROM t2 WHERE a=? AND +b=?} { t2+ t2a t2b* t2c* }
   3 { DELETE FROM t2 WHERE a=? OR b=?}   { t2 t2a* t2b* t2c* }
   4 { DELETE FROM t2 WHERE +a=? }        { t2 t2a* t2b* t2c* }
   5 { DELETE FROM t2 WHERE rowid=? }     { t2 t2a* t2b* t2c* }