]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Simplification of tests and more added for SQLITE_OMIT_UNIQUE_ENFORCEMENT tests.
authorshaneh <shaneh@noemail.net>
Thu, 10 Mar 2011 21:48:02 +0000 (21:48 +0000)
committershaneh <shaneh@noemail.net>
Thu, 10 Mar 2011 21:48:02 +0000 (21:48 +0000)
FossilOrigin-Name: 75a38411a89bd2969ec5cecca13c13a390b3d478

manifest
manifest.uuid
test/omitunique.test

index b4381bea7f178b64debb399a6803b6d9feea4847..babc6cadde06dce99335958d824e87ea13022816 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Skip\sunique\sconstraint\senforcement\sif\scompiled\swith\sSQLITE_OMIT_UNIQUE_ENFORCEMENT.
-D 2011-03-10T21:13:18.347
+C Simplification\sof\stests\sand\smore\sadded\sfor\sSQLITE_OMIT_UNIQUE_ENFORCEMENT\stests.
+D 2011-03-10T21:48:02.401
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 27701a1653595a1f2187dc61c8117e00a6c1d50f
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -584,7 +584,7 @@ F test/notify2.test 195a467e021f74197be2c4fb02d6dee644b8d8db
 F test/notify3.test d60923e186e0900f4812a845fcdfd8eea096e33a
 F test/notnull.test cc7c78340328e6112a13c3e311a9ab3127114347
 F test/null.test a8b09b8ed87852742343b33441a9240022108993
-F test/omitunique.test f153c7540f2df6dc49c56b97242bda6b60e87fa6
+F test/omitunique.test 03747013c870bb4c14c3fbaeb13dae8c6efad9f2
 F test/openv2.test af02ed0a9cbc0d2a61b8f35171d4d117e588e4ec
 F test/oserror.test d1f085bdbac20456fccdf5877f52016453654fc3
 F test/pager1.test d8672fd0af5f4f9b99b06283d00f01547809bebe
@@ -913,7 +913,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P 3643842316239ff7859f0ec522736a2b9c03d22c
-R b1f7b8ea9c365b449d3359fe4224fd3a
+P ba85bf8cb88f7ae220d919f5c23f51d9dcedc843
+R 62d3b55d8406e6fbbc3a5bfec0a6bc04
 U shaneh
-Z c08bc88ba8510c7d87325ff4426508db
+Z 0d4d7d2864ef8876819acc631335ab7b
index 79f5cbdfb7c7d80286ae919f28a78aa7a5fdf930..67b1ecec7cff11658ab076055f90a00369c6637a 100644 (file)
@@ -1 +1 @@
-ba85bf8cb88f7ae220d919f5c23f51d9dcedc843
\ No newline at end of file
+75a38411a89bd2969ec5cecca13c13a390b3d478
\ No newline at end of file
index 633aaa07d0b2ddd07379974cb349c9f3b3bed95f..1ed6726e0f6a2345b206b496f734a8711afb63aa 100644 (file)
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
 
+set uniq_enforced 1
+ifcapable !unique_enforcement {
+  set uniq_enforced 0
+}
+
 # table with UNIQUE keyword on column
 do_test omitunique-1.1.1 {
   catchsql {CREATE TABLE t1(a TEXT UNIQUE);  }
@@ -87,61 +92,65 @@ foreach {j tbl uniq cnt_enforce cnt_omit qp_est} {
     7 {INSERT OR ROLLBACK} 1
   } {
 
-    if { $uniq==0 || $err==0 } { 
-      set msg {0 {}} 
+    ifcapable explain {
+      ifcapable unique_enforcement {
+          do_test omitunique-2.1.$j.$i.1 {
+            set x [execsql [ subst {EXPLAIN $cmd INTO $tbl (a) VALUES('abc')}]]
+            regexp { IsUnique } $x
+          } $uniq
+      }
+      ifcapable !unique_enforcement {
+          do_test omitunique-2.1.$j.$i.1 {
+            set x [execsql [ subst {EXPLAIN $cmd INTO $tbl (a) VALUES('abc')}]]
+            regexp { IsUnique } $x
+          } {0}
+      }
+      do_test omitunique-2.1.$j.2 {
+        set x [execsql [ subst {EXPLAIN $cmd INTO $tbl (a) VALUES('abc')}]]
+        regexp { Next } $x
+      } {0}
+    }
+
+    if { $uniq_enforced==0 || $uniq==0 || $err==0 } { 
+      set msg {0 {}}
     } {
       set msg {1 {column a is not unique}}
     }
+    do_test omitunique-2.1.$j.$i.3 {
+      catchsql [ subst {$cmd INTO $tbl (a) VALUES('abc')}]
+    } $msg
+
+  }
+  # end foreach cmd
 
+  # check UPDATE command
+  ifcapable explain {
     ifcapable unique_enforcement {
-      ifcapable explain {
-        do_test omitunique-2.1.$j.$i.1 {
-          set x [execsql [ subst {EXPLAIN $cmd INTO $tbl (a) VALUES('abc')}]]
+        do_test omitunique-2.2.$j.1 {
+          set x [execsql [ subst {EXPLAIN UPDATE $tbl SET a='abc'}]]
           regexp { IsUnique } $x
         } $uniq
-      }
-      do_test omitunique-2.1.$j.$i.2 {
-        catchsql [ subst {$cmd INTO $tbl (a) VALUES('abc')}]
-      } $msg
     }
     ifcapable !unique_enforcement {
-      ifcapable explain {
-        do_test omitunique-2.1.$j.$i.1 {
-          set x [execsql [ subst {EXPLAIN $cmd INTO $tbl (a) VALUES('abc')}]]
+        do_test omitunique-2.2.$j.1 {
+          set x [execsql [ subst {EXPLAIN UPDATE $tbl SET a='abc'}]]
           regexp { IsUnique } $x
         } {0}
-      }
-      do_test omitunique-2.1.$j.$i.2 {
-        catchsql [ subst {$cmd INTO $tbl (a) VALUES('abc')}]
-      } {0 {}}
     }
-
+# comment out for now
+#    do_test omitunique-2.2.$j.2 {
+#      set x [execsql [ subst {EXPLAIN UPDATE $tbl SET a='abc' WHERE a<>'abc'}]]
+#      regexp { Next } $x
+#    } {0}
   }
-  # end foreach cmd
-
-  # check UPDATE command
-  ifcapable unique_enforcement {
-    ifcapable explain {
-      do_test omitunique-2.2.$j.1 {
-        set x [execsql [ subst {EXPLAIN UPDATE $tbl SET a='abc'}]]
-        regexp { IsUnique } $x
-      } $uniq
-    }
-    do_test omitunique-2.2.$j.2 {
-      catchsql [ subst {UPDATE $tbl SET a='abc'}]
-    } $msg
-  }
-  ifcapable !unique_enforcement {
-    ifcapable explain {
-      do_test omitunique-2.2.$j.1 {
-        set x [execsql [ subst {EXPLAIN UPDATE $tbl SET a='abc'}]]
-        regexp { IsUnique } $x
-      } {0}
-    }
-    do_test omitunique-2.2.$j.2 {
-      catchsql [ subst {UPDATE $tbl SET a='abc' }]
-    } {0 {}}
+  if { $uniq_enforced==0 || $uniq==0 } { 
+    set msg {0 {}}
+  } {
+    set msg {1 {column a is not unique}}
   }
+  do_test omitunique-2.2.$j.3 {
+    catchsql [ subst {UPDATE $tbl SET a='abc'}]
+  } $msg
 
   # check record counts
   ifcapable unique_enforcement {
@@ -158,7 +167,7 @@ foreach {j tbl uniq cnt_enforce cnt_omit qp_est} {
   # make sure the query planner row estimate not affected because of omit enforcement
   ifcapable explain {
     do_test omitunique-2.4.$j {
-      set x [execsql [ subst {EXPLAIN QUERY PLAN SELECT count(*) FROM $tbl WHERE a='abc' }]]
+      set x [ execsql [ subst {EXPLAIN QUERY PLAN SELECT count(*) FROM $tbl WHERE a='abc' }]]
       set y [ subst {~$qp_est row} ]
       regexp $y $x
     } {1}