Merge lp:~zorba-coders/zorba/jsoniq-multiple-updates-fix into lp:zorba

Proposed by Ghislain Fourny
Status: Merged
Approved by: Markos Zaharioudakis
Approved revision: 10924
Merged at revision: 10947
Proposed branch: lp:~zorba-coders/zorba/jsoniq-multiple-updates-fix
Merge into: lp:zorba
Diff against target: 136 lines (+58/-5)
9 files modified
src/store/naive/simple_pul.cpp (+6/-5)
test/rbkt/ExpQueryResults/zorba/jsoniq/arr_update_01.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/jsoniq/obj_update_01.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/jsoniq/obj_update_02.xml.res (+1/-0)
test/rbkt/Queries/zorba/jsoniq/arr_update_01.xq (+12/-0)
test/rbkt/Queries/zorba/jsoniq/arr_update_02.spec (+1/-0)
test/rbkt/Queries/zorba/jsoniq/arr_update_02.xq (+13/-0)
test/rbkt/Queries/zorba/jsoniq/obj_update_01.xq (+11/-0)
test/rbkt/Queries/zorba/jsoniq/obj_update_02.xq (+12/-0)
To merge this branch: bzr merge lp:~zorba-coders/zorba/jsoniq-multiple-updates-fix
Reviewer Review Type Date Requested Status
Markos Zaharioudakis Approve
Matthias Brantner Approve
Review via email: mp+114183@code.launchpad.net

Commit message

Fix that gives precedence to an array replacement over an array deletion, and adds tests about multiple updates with same selector on arrays and on objects.

Description of the change

Fix that gives precedence to an array replacement over an array deletion, and adds tests about multiple updates with same selector on arrays and on objects.

To post a comment you must log in.
Revision history for this message
Matthias Brantner (matthias-brantner) :
review: Approve
Revision history for this message
Markos Zaharioudakis (markos-za) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job jsoniq-multiple-updates-fix-2012-07-19T04-46-07.149Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/store/naive/simple_pul.cpp'
--- src/store/naive/simple_pul.cpp 2012-07-04 12:56:09 +0000
+++ src/store/naive/simple_pul.cpp 2012-07-10 13:06:20 +0000
@@ -1531,7 +1531,8 @@
15311531
1532 for (; ite != end; ++ite)1532 for (; ite != end; ++ite)
1533 {1533 {
1534 if ((*ite)->getKind() != store::UpdateConsts::UP_JSON_ARRAY_DELETE)1534 if ((*ite)->getKind() != store::UpdateConsts::UP_JSON_ARRAY_DELETE &&
1535 (*ite)->getKind() != store::UpdateConsts::UP_JSON_ARRAY_REPLACE_VALUE)
1535 continue;1536 continue;
15361537
1537 UpdJSONArrayUpdate* upd = static_cast<UpdJSONArrayUpdate*>(*ite);1538 UpdJSONArrayUpdate* upd = static_cast<UpdJSONArrayUpdate*>(*ite);
@@ -1611,7 +1612,7 @@
1611 1612
1612 if (upd->thePosition == pos)1613 if (upd->thePosition == pos)
1613 {1614 {
1614 return;1615 ite = updates->erase(ite);
1615 }1616 }
1616 }1617 }
1617 }1618 }
@@ -2094,7 +2095,8 @@
20942095
2095 for (; ite != end; ++ite)2096 for (; ite != end; ++ite)
2096 {2097 {
2097 if ((*ite)->getKind() != otherUpdKind)2098 if ((*ite)->getKind() != store::UpdateConsts::UP_JSON_ARRAY_DELETE &&
2099 (*ite)->getKind() != store::UpdateConsts::UP_JSON_ARRAY_REPLACE_VALUE)
2098 continue;2100 continue;
20992101
2100 UpdJSONArrayUpdate* myUpd = static_cast<UpdJSONArrayUpdate*>(*ite);2102 UpdJSONArrayUpdate* myUpd = static_cast<UpdJSONArrayUpdate*>(*ite);
@@ -2133,8 +2135,7 @@
2133 {2135 {
2134 if (myUpd->thePosition == otherUpd2->thePosition)2136 if (myUpd->thePosition == otherUpd2->thePosition)
2135 {2137 {
2136 merged = true;2138 ite = targetUpdates->erase(ite);
2137 break;
2138 }2139 }
2139 }2140 }
2140 }2141 }
21412142
=== added file 'test/rbkt/ExpQueryResults/zorba/jsoniq/arr_update_01.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsoniq/arr_update_01.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsoniq/arr_update_01.xml.res 2012-07-10 13:06:20 +0000
@@ -0,0 +1,1 @@
1[ 1, 5, 6, 4, 3 ]
0\ No newline at end of file2\ No newline at end of file
13
=== added file 'test/rbkt/ExpQueryResults/zorba/jsoniq/obj_update_01.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsoniq/obj_update_01.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsoniq/obj_update_01.xml.res 2012-07-10 13:06:20 +0000
@@ -0,0 +1,1 @@
1{ "foo2" : "bar2", "bar" : "foo" }
02
=== added file 'test/rbkt/ExpQueryResults/zorba/jsoniq/obj_update_02.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsoniq/obj_update_02.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsoniq/obj_update_02.xml.res 2012-07-10 13:06:20 +0000
@@ -0,0 +1,1 @@
1{ "bar" : "foo" }
02
=== added file 'test/rbkt/Queries/zorba/jsoniq/arr_update_01.xq'
--- test/rbkt/Queries/zorba/jsoniq/arr_update_01.xq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsoniq/arr_update_01.xq 2012-07-10 13:06:20 +0000
@@ -0,0 +1,12 @@
1import module namespace j = "http://www.jsoniq.org/functions";
2
3variable $a := [ 1, 2, 3];
4
5(
6 replace json value of $a(2) with 4,
7 insert json (5, 6) into $a at position 2,
8 delete json $a(2),
9 delete json $a(2)
10);
11
12$a
013
=== added file 'test/rbkt/Queries/zorba/jsoniq/arr_update_02.spec'
--- test/rbkt/Queries/zorba/jsoniq/arr_update_02.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsoniq/arr_update_02.spec 2012-07-10 13:06:20 +0000
@@ -0,0 +1,1 @@
1Error: http://www.jsoniq.org/errors:JNUP0009
0\ No newline at end of file2\ No newline at end of file
13
=== added file 'test/rbkt/Queries/zorba/jsoniq/arr_update_02.xq'
--- test/rbkt/Queries/zorba/jsoniq/arr_update_02.xq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsoniq/arr_update_02.xq 2012-07-10 13:06:20 +0000
@@ -0,0 +1,13 @@
1import module namespace j = "http://www.jsoniq.org/functions";
2
3variable $a := [ 1, 2, 3];
4
5(
6 replace json value of $a(2) with 4,
7 replace json value of $a(2) with 4,
8 insert json (5, 6) into $a at position 2,
9 delete json $a(2),
10 delete json $a(2)
11);
12
13$a
014
=== added file 'test/rbkt/Queries/zorba/jsoniq/obj_update_01.xq'
--- test/rbkt/Queries/zorba/jsoniq/obj_update_01.xq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsoniq/obj_update_01.xq 2012-07-10 13:06:20 +0000
@@ -0,0 +1,11 @@
1import module namespace j = "http://www.jsoniq.org/functions";
2
3variable $o := { "foo" : "bar" };
4
5(
6 replace json value of $o("foo") with "bar2",
7 rename json $o("foo") as "foo2",
8 insert json { "bar" : "foo" } into $o
9);
10
11$o
012
=== added file 'test/rbkt/Queries/zorba/jsoniq/obj_update_02.xq'
--- test/rbkt/Queries/zorba/jsoniq/obj_update_02.xq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsoniq/obj_update_02.xq 2012-07-10 13:06:20 +0000
@@ -0,0 +1,12 @@
1import module namespace j = "http://www.jsoniq.org/functions";
2
3variable $o := { "foo" : "bar" };
4
5(
6 replace json value of $o("foo") with "bar2",
7 rename json $o("foo") as "foo2",
8 insert json { "bar" : "foo" } into $o,
9 delete json $o("foo")
10);
11
12$o

Subscribers

People subscribed via source and target branches