← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/bug-1092842 into lp:zorba

 

Ghislain Fourny has proposed merging lp:~zorba-coders/zorba/bug-1092842 into lp:zorba.

Commit message:
"Fixing bug 1092842 (tree pointers of nested items in an object or array do not get swapped correctly upon dml:edit.)"

Requested reviews:
  Chris Hillery (ceejatec)
  Matthias Brantner (matthias-brantner)
Related bugs:
  Bug #1092842 in Zorba: "Assertion fails when dml:editing nested JSON items."
  https://bugs.launchpad.net/zorba/+bug/1092842

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

"Fixing bug 1092842 (tree pointers of nested items in an object or array do not get swapped correctly upon dml:edit.)"
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-1092842/+merge/141049
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/store/naive/json_items.cpp'
--- src/store/naive/json_items.cpp	2012-12-14 13:11:51 +0000
+++ src/store/naive/json_items.cpp	2012-12-21 10:07:25 +0000
@@ -503,6 +503,8 @@
   assert(lOther);
   std::swap(theKeys, lOther->theKeys);
   std::swap(thePairs, lOther->thePairs);
+  setTree(getTree());
+  lOther->setTree(lOther->getTree());
 }
 
 /******************************************************************************
@@ -934,6 +936,8 @@
   SimpleJSONArray* lOther = dynamic_cast<SimpleJSONArray*>(anotherItem);
   assert(lOther);
   std::swap(theContent, lOther->theContent);
+  setTree(getTree());
+  lOther->setTree(lOther->getTree());
 }
 
 /******************************************************************************

=== added file 'test/rbkt/ExpQueryResults/zorba/collections/edit/edit_collection_018.xml.res'
--- test/rbkt/ExpQueryResults/zorba/collections/edit/edit_collection_018.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/collections/edit/edit_collection_018.xml.res	2012-12-21 10:07:25 +0000
@@ -0,0 +1,1 @@
+{ "bar" : "foo", "foo" : [ { "foo" : "bar" } ] }

=== added file 'test/rbkt/ExpQueryResults/zorba/collections/edit/edit_collection_019.xml.res'
--- test/rbkt/ExpQueryResults/zorba/collections/edit/edit_collection_019.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/collections/edit/edit_collection_019.xml.res	2012-12-21 10:07:25 +0000
@@ -0,0 +1,1 @@
+[ 1, 2, 3, [ { "foo" : "bar" } ] ]

=== modified file 'test/rbkt/Queries/zorba/collections/collection_001.xqdata'
--- test/rbkt/Queries/zorba/collections/collection_001.xqdata	2012-12-11 14:47:49 +0000
+++ test/rbkt/Queries/zorba/collections/collection_001.xqdata	2012-12-21 10:07:25 +0000
@@ -8,6 +8,8 @@
 
 declare collection ns:collection-objects as object()*;
 
+declare collection ns:collection-arrays as array()*;
+
 declare %ann:ordered collection ns:collection2;
 
 declare %ann:const collection ns:collection_const as node()*;

=== added file 'test/rbkt/Queries/zorba/collections/edit/edit_collection_018.xq'
--- test/rbkt/Queries/zorba/collections/edit/edit_collection_018.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/collections/edit/edit_collection_018.xq	2012-12-21 10:07:25 +0000
@@ -0,0 +1,12 @@
+import module namespace ddl = "http://www.zorba-xquery.com/modules/store/static/collections/ddl";;
+import module namespace dml = "http://www.zorba-xquery.com/modules/store/static/collections/dml";;
+
+import module namespace ns = "http://www.example.com/example"; at "../collection_001.xqdata";
+
+ddl:create(xs:QName("ns:collection-objects"));
+
+dml:insert(xs:QName("ns:collection-objects"), { "foo" : "bar", "bar" : [ 1, 2, 3, { "foo" : "bar" } ]  });
+
+dml:edit(dml:collection(xs:QName("ns:collection-objects")), { "bar" : "foo", "foo" : [ { "foo" : "bar" } ] });
+
+dml:collection(xs:QName("ns:collection-objects"))

=== added file 'test/rbkt/Queries/zorba/collections/edit/edit_collection_019.xq'
--- test/rbkt/Queries/zorba/collections/edit/edit_collection_019.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/collections/edit/edit_collection_019.xq	2012-12-21 10:07:25 +0000
@@ -0,0 +1,12 @@
+import module namespace ddl = "http://www.zorba-xquery.com/modules/store/static/collections/ddl";;
+import module namespace dml = "http://www.zorba-xquery.com/modules/store/static/collections/dml";;
+
+import module namespace ns = "http://www.example.com/example"; at "../collection_001.xqdata";
+
+ddl:create(xs:QName("ns:collection-arrays"));
+
+dml:insert(xs:QName("ns:collection-arrays"), [ { "foo" : "bar" }, 1, 2, 3 ]);
+
+dml:edit(dml:collection(xs:QName("ns:collection-arrays")), [ 1, 2, 3, [ { "foo" : "bar" } ] ]);
+
+dml:collection(xs:QName("ns:collection-arrays"))


Follow ups