Matthias Brantner has proposed merging lp:~zorba-coders/zorba/bug-966706 into 
lp:zorba.

Requested reviews:
  Markos Zaharioudakis (markos-za)
  Till Westmann (tillw)
Related bugs:
  Bug #966706 in Zorba: "key uniqueness of value equality index not enforced"
  https://bugs.launchpad.net/zorba/+bug/966706

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug-966706/+merge/101498

fixed bug #966706 (key uniqueness of value equality index not enforced)
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-966706/+merge/101498
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog'
--- ChangeLog	2012-04-10 15:41:57 +0000
+++ ChangeLog	2012-04-11 07:12:20 +0000
@@ -16,8 +16,12 @@
   * Fixed bug #967428 (do not hoist index creation outside a try-catch)
   * Fixed performance problem with the findNodeSources function of the no-copy rule
   * Fixed bug #872234 (prevent a rewritting to take place in case of sequential expr)
+<<<<<<< TREE
   * Fixed bug #912586, #912593 and #912722 (assertion failures with lax validation)
   * Fixed bug #949910 (has-children may be invoked on all nodes). Internally, zorba::store::Item::getChildren() now returns NULL on node classes without offspring (instead of raising an error).
+=======
+  * Fixed bug #966706 (key uniqueness of value equality index not enforced)
+>>>>>>> MERGE-SOURCE
 
 
 version 2.2

=== modified file 'src/store/naive/simple_pul.cpp'
--- src/store/naive/simple_pul.cpp	2012-03-28 05:19:57 +0000
+++ src/store/naive/simple_pul.cpp	2012-04-11 07:12:20 +0000
@@ -1746,6 +1746,16 @@
       CollectionPul* pul = collIte->second;
       applyList(pul->theDeleteCollectionList);
     }
+
+    // Need to do this here because refreshIndices can raise an error (e.g. if
+    // the unique constraint of an index is violated)
+    for (collIte = theCollectionPuls.begin(); collIte != collEnd; ++collIte)
+    {
+      CollectionPul* pul = collIte->second;
+      // Refresh each incrementally maintained index using its before and after
+      // deltas. 
+      pul->refreshIndices();
+    }
   }
   catch (...)
   {
@@ -2228,10 +2238,6 @@
 {
   try
   {
-    // Refresh each incrementally maintained index using its before and after
-    // deltas. 
-    refreshIndices();
-
     // If necessary, adjust the position of trees inside this collection.
     if (theAdjustTreePositions)
     {

=== added file 'test/rbkt/ExpQueryResults/zorba/index/unique.xml.res'
--- test/rbkt/ExpQueryResults/zorba/index/unique.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/index/unique.xml.res	2012-04-11 07:12:20 +0000
@@ -0,0 +1,1 @@
+zerr:ZDDY0024 zerr:ZDDY0024

=== added file 'test/rbkt/Queries/zorba/index/unique.xq'
--- test/rbkt/Queries/zorba/index/unique.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/index/unique.xq	2012-04-11 07:12:20 +0000
@@ -0,0 +1,27 @@
+import module namespace u = "http://www.zorba-xquery.com/unique-index"; at "unique.xqlib";
+
+import module namespace dml = "http://www.zorba-xquery.com/modules/store/static/collections/dml";;
+import module namespace idml = "http://www.zorba-xquery.com/modules/store/static/indexes/dml";;
+
+declare namespace zerr = "http://www.zorba-xquery.com/errors";;
+declare namespace err = "http://www.w3.org/2005/xqt-errors";;
+
+u:create-db();
+
+try
+{{
+  (dml:insert-nodes($u:auctions1, <person id="1"/>),
+  dml:insert-nodes($u:auctions1, <person id="1"/>));
+  ()
+}} catch * {
+  $err:code, dml:collection($u:auctions1)
+},
+
+try
+{{
+  (dml:insert-nodes($u:auctions2, <person id="1"/>),
+  dml:insert-nodes($u:auctions2, <person id="1"/>));
+  ()
+}} catch * {
+  $err:code, dml:collection($u:auctions2)
+}

=== added file 'test/rbkt/Queries/zorba/index/unique.xqlib'
--- test/rbkt/Queries/zorba/index/unique.xqlib	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/index/unique.xqlib	2012-04-11 07:12:20 +0000
@@ -0,0 +1,36 @@
+module namespace auctions = "http://www.zorba-xquery.com/unique-index";;
+
+import module namespace ddl = "http://www.zorba-xquery.com/modules/store/static/collections/ddl";;
+import module namespace iddl = "http://www.zorba-xquery.com/modules/store/static/indexes/ddl";;
+import module namespace dml = "http://www.zorba-xquery.com/modules/store/static/collections/dml";;
+import module namespace idml = "http://www.zorba-xquery.com/modules/store/static/indexes/dml";;
+
+declare namespace ann = "http://www.zorba-xquery.com/annotations";;
+
+declare variable $auctions:auctions1 := xs:QName("auctions:auctions1");
+declare variable $auctions:PersonId1 := xs:QName("auctions:PersonId1");
+declare variable $auctions:auctions2 := xs:QName("auctions:auctions2");
+declare variable $auctions:PersonId2 := xs:QName("auctions:PersonId2");
+
+declare collection auctions:auctions1 as node()*;
+
+declare %ann:unique %ann:automatic %ann:value-equality index auctions:PersonId1
+on nodes dml:collection(xs:QName("auctions:auctions1"))
+by xs:string(./@id) as xs:string;
+
+declare collection auctions:auctions2 as node()*;
+
+declare %ann:unique %ann:automatic %ann:value-range index auctions:PersonId2
+on nodes dml:collection(xs:QName("auctions:auctions2"))
+by xs:string(./@id) as xs:string;
+
+declare %ann:sequential function auctions:create-db()
+{
+  ddl:create($auctions:auctions1);
+
+  ddl:create($auctions:auctions2);
+
+  iddl:create($auctions:PersonId1);
+
+  iddl:create($auctions:PersonId2);
+};

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to     : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp

Reply via email to