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

Requested reviews:
  Matthias Brantner (matthias-brantner)
  David Graf (davidagraf)
Related bugs:
  Bug #867253 in Zorba: "cdml:delete-nodes should only remove root nodes"
  https://bugs.launchpad.net/zorba/+bug/867253

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

fix for bug #867253 (cdml:delete-nodes should only remove root nodes)
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-867253/+merge/101693
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog'
--- ChangeLog	2012-04-10 15:41:57 +0000
+++ ChangeLog	2012-04-12 07:56:20 +0000
@@ -13,6 +13,7 @@
   * Fixed bug #967864 (var substitution did not update theFreeVars property)
   * Fixed bug in window iterator (binding the end vars in the output tuple stream)
   * Fixed bug #866547 (protect index-join rule from general flwor)
+  * Fixed bug #867253 (cdml:delete-nodes should only remove root nodes)
   * 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)

=== modified file 'include/zorba/pregenerated/diagnostic_list.h'
--- include/zorba/pregenerated/diagnostic_list.h	2012-03-28 05:19:57 +0000
+++ include/zorba/pregenerated/diagnostic_list.h	2012-04-12 07:56:20 +0000
@@ -606,16 +606,18 @@
 
 extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0030_INDEX_RANGE_GENERAL_PROBE_NOT_ALLOWED;
 
-extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0034_INDEX_RANGE_VALUE_PROBE_BAD_KEY_TYPES;
-
-extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0035_INDEX_GENERAL_INSERT;
-
 extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0031_IC_NOT_DECLARED;
 
 extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0032_IC_NOT_ACTIVATED;
 
 extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0033_IC_NOT_MET;
 
+extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0034_INDEX_RANGE_VALUE_PROBE_BAD_KEY_TYPES;
+
+extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0035_INDEX_GENERAL_INSERT;
+
+extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0036_NON_ROOT_NODE_DELETION;
+
 extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDST0001_COLLECTION_ALREADY_DECLARED;
 
 extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDST0002_COLLECTION_ALREADY_IMPORTED;

=== modified file 'modules/com/zorba-xquery/www/modules/pregenerated/errors.xq'
--- modules/com/zorba-xquery/www/modules/pregenerated/errors.xq	2012-03-28 05:19:57 +0000
+++ modules/com/zorba-xquery/www/modules/pregenerated/errors.xq	2012-04-12 07:56:20 +0000
@@ -513,14 +513,6 @@
 
 (:~
 :)
-declare variable $zerr:ZDDY0034 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0034");
-
-(:~
-:)
-declare variable $zerr:ZDDY0035 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0035");
-
-(:~
-:)
 declare variable $zerr:ZDDY0031 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0031");
 
 (:~
@@ -533,6 +525,18 @@
 
 (:~
 :)
+declare variable $zerr:ZDDY0034 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0034");
+
+(:~
+:)
+declare variable $zerr:ZDDY0035 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0035");
+
+(:~
+:)
+declare variable $zerr:ZDDY0036 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0036");
+
+(:~
+:)
 declare variable $zerr:ZDST0001 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0001");
 
 (:~

=== modified file 'src/diagnostics/diagnostic_en.xml'
--- src/diagnostics/diagnostic_en.xml	2012-03-28 05:19:57 +0000
+++ src/diagnostics/diagnostic_en.xml	2012-04-12 07:56:20 +0000
@@ -2069,14 +2069,6 @@
       <value>"$1": index range-general probe not allowed</value>
     </diagnostic>
 
-    <diagnostic code="ZDDY0034" name="INDEX_RANGE_VALUE_PROBE_BAD_KEY_TYPES">
-      <value>"$1": index range-value probe has search keys with incompatible types</value>
-    </diagnostic>
-
-    <diagnostic code="ZDDY0035" name="INDEX_GENERAL_INSERT">
-      <value>"$1": index inserting more than one key not allowed for general index</value>
-    </diagnostic>
-
     <diagnostic code="ZDDY0031" name="IC_NOT_DECLARED">
       <value>"$1": integrity constraint is not declared</value>
     </diagnostic>
@@ -2089,6 +2081,17 @@
       <value>"$1": integrity constraint not met for collection "$2"</value>
     </diagnostic>
 
+    <diagnostic code="ZDDY0034" name="INDEX_RANGE_VALUE_PROBE_BAD_KEY_TYPES">
+      <value>"$1": index range-value probe has search keys with incompatible types</value>
+    </diagnostic>
+
+    <diagnostic code="ZDDY0035" name="INDEX_GENERAL_INSERT">
+      <value>"$1": index inserting more than one key not allowed for general index</value>
+    </diagnostic>
+
+    <diagnostic code="ZDDY0036" name="NON_ROOT_NODE_DELETION">
+      <value>attempt to delete non-root node from collection "$1"</value>
+    </diagnostic>
 
     <diagnostic code="ZDST0001" name="COLLECTION_ALREADY_DECLARED">
       <value>"$1": collection already declared</value>

=== modified file 'src/diagnostics/pregenerated/diagnostic_list.cpp'
--- src/diagnostics/pregenerated/diagnostic_list.cpp	2012-03-28 05:19:57 +0000
+++ src/diagnostics/pregenerated/diagnostic_list.cpp	2012-04-12 07:56:20 +0000
@@ -888,12 +888,6 @@
 ZorbaErrorCode ZDDY0030_INDEX_RANGE_GENERAL_PROBE_NOT_ALLOWED( "ZDDY0030" );
 
 
-ZorbaErrorCode ZDDY0034_INDEX_RANGE_VALUE_PROBE_BAD_KEY_TYPES( "ZDDY0034" );
-
-
-ZorbaErrorCode ZDDY0035_INDEX_GENERAL_INSERT( "ZDDY0035" );
-
-
 ZorbaErrorCode ZDDY0031_IC_NOT_DECLARED( "ZDDY0031" );
 
 
@@ -903,6 +897,15 @@
 ZorbaErrorCode ZDDY0033_IC_NOT_MET( "ZDDY0033" );
 
 
+ZorbaErrorCode ZDDY0034_INDEX_RANGE_VALUE_PROBE_BAD_KEY_TYPES( "ZDDY0034" );
+
+
+ZorbaErrorCode ZDDY0035_INDEX_GENERAL_INSERT( "ZDDY0035" );
+
+
+ZorbaErrorCode ZDDY0036_NON_ROOT_NODE_DELETION( "ZDDY0036" );
+
+
 ZorbaErrorCode ZDST0001_COLLECTION_ALREADY_DECLARED( "ZDST0001" );
 
 

=== modified file 'src/diagnostics/pregenerated/dict_en.cpp'
--- src/diagnostics/pregenerated/dict_en.cpp	2012-03-28 05:19:57 +0000
+++ src/diagnostics/pregenerated/dict_en.cpp	2012-04-12 07:56:20 +0000
@@ -301,6 +301,7 @@
   { "ZDDY0033", "\"$1\": integrity constraint not met for collection \"$2\"" },
   { "ZDDY0034", "\"$1\": index range-value probe has search keys with incompatible types" },
   { "ZDDY0035", "\"$1\": index inserting more than one key not allowed for general index" },
+  { "ZDDY0036", "attempt to delete non-root node from collection \"$1\"" },
   { "ZDST0001", "\"$1\": collection already declared" },
   { "ZDST0002", "\"$1\": collection already imported into module \"$2\"" },
   { "ZDST0003", "\"$1\": collection declaration not allowed in main module" },

=== modified file 'src/runtime/collections/collections_impl.cpp'
--- src/runtime/collections/collections_impl.cpp	2012-04-08 21:39:25 +0000
+++ src/runtime/collections/collections_impl.cpp	2012-04-12 07:56:20 +0000
@@ -1520,10 +1520,18 @@
 
   while (consumeNext(node, theChildren[theChildren.size()-1].getp(), planState))
   {
-    if (! node->getCollection()) 
+    if (! node->getCollection())
     {
       throw XQUERY_EXCEPTION( zerr::ZDDY0017_NODE_IS_ORPHAN, ERROR_LOC( loc ) );
     }
+    if (node->getParent())
+    {
+      throw XQUERY_EXCEPTION(
+        zerr::ZDDY0036_NON_ROOT_NODE_DELETION,
+        ERROR_PARAMS(node->getCollection()->getName()->getStringValue()),
+        ERROR_LOC( loc )
+      );
+    }
     if (collection && collection != node->getCollection()) 
     {
       throw XQUERY_EXCEPTION(

-- 
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