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
1=== modified file 'src/store/naive/simple_pul.cpp'
2--- src/store/naive/simple_pul.cpp 2012-07-04 12:56:09 +0000
3+++ src/store/naive/simple_pul.cpp 2012-07-10 13:06:20 +0000
4@@ -1531,7 +1531,8 @@
5
6 for (; ite != end; ++ite)
7 {
8- if ((*ite)->getKind() != store::UpdateConsts::UP_JSON_ARRAY_DELETE)
9+ if ((*ite)->getKind() != store::UpdateConsts::UP_JSON_ARRAY_DELETE &&
10+ (*ite)->getKind() != store::UpdateConsts::UP_JSON_ARRAY_REPLACE_VALUE)
11 continue;
12
13 UpdJSONArrayUpdate* upd = static_cast<UpdJSONArrayUpdate*>(*ite);
14@@ -1611,7 +1612,7 @@
15
16 if (upd->thePosition == pos)
17 {
18- return;
19+ ite = updates->erase(ite);
20 }
21 }
22 }
23@@ -2094,7 +2095,8 @@
24
25 for (; ite != end; ++ite)
26 {
27- if ((*ite)->getKind() != otherUpdKind)
28+ if ((*ite)->getKind() != store::UpdateConsts::UP_JSON_ARRAY_DELETE &&
29+ (*ite)->getKind() != store::UpdateConsts::UP_JSON_ARRAY_REPLACE_VALUE)
30 continue;
31
32 UpdJSONArrayUpdate* myUpd = static_cast<UpdJSONArrayUpdate*>(*ite);
33@@ -2133,8 +2135,7 @@
34 {
35 if (myUpd->thePosition == otherUpd2->thePosition)
36 {
37- merged = true;
38- break;
39+ ite = targetUpdates->erase(ite);
40 }
41 }
42 }
43
44=== added file 'test/rbkt/ExpQueryResults/zorba/jsoniq/arr_update_01.xml.res'
45--- test/rbkt/ExpQueryResults/zorba/jsoniq/arr_update_01.xml.res 1970-01-01 00:00:00 +0000
46+++ test/rbkt/ExpQueryResults/zorba/jsoniq/arr_update_01.xml.res 2012-07-10 13:06:20 +0000
47@@ -0,0 +1,1 @@
48+[ 1, 5, 6, 4, 3 ]
49\ No newline at end of file
50
51=== added file 'test/rbkt/ExpQueryResults/zorba/jsoniq/obj_update_01.xml.res'
52--- test/rbkt/ExpQueryResults/zorba/jsoniq/obj_update_01.xml.res 1970-01-01 00:00:00 +0000
53+++ test/rbkt/ExpQueryResults/zorba/jsoniq/obj_update_01.xml.res 2012-07-10 13:06:20 +0000
54@@ -0,0 +1,1 @@
55+{ "foo2" : "bar2", "bar" : "foo" }
56
57=== added file 'test/rbkt/ExpQueryResults/zorba/jsoniq/obj_update_02.xml.res'
58--- test/rbkt/ExpQueryResults/zorba/jsoniq/obj_update_02.xml.res 1970-01-01 00:00:00 +0000
59+++ test/rbkt/ExpQueryResults/zorba/jsoniq/obj_update_02.xml.res 2012-07-10 13:06:20 +0000
60@@ -0,0 +1,1 @@
61+{ "bar" : "foo" }
62
63=== added file 'test/rbkt/Queries/zorba/jsoniq/arr_update_01.xq'
64--- test/rbkt/Queries/zorba/jsoniq/arr_update_01.xq 1970-01-01 00:00:00 +0000
65+++ test/rbkt/Queries/zorba/jsoniq/arr_update_01.xq 2012-07-10 13:06:20 +0000
66@@ -0,0 +1,12 @@
67+import module namespace j = "http://www.jsoniq.org/functions";
68+
69+variable $a := [ 1, 2, 3];
70+
71+(
72+ replace json value of $a(2) with 4,
73+ insert json (5, 6) into $a at position 2,
74+ delete json $a(2),
75+ delete json $a(2)
76+);
77+
78+$a
79
80=== added file 'test/rbkt/Queries/zorba/jsoniq/arr_update_02.spec'
81--- test/rbkt/Queries/zorba/jsoniq/arr_update_02.spec 1970-01-01 00:00:00 +0000
82+++ test/rbkt/Queries/zorba/jsoniq/arr_update_02.spec 2012-07-10 13:06:20 +0000
83@@ -0,0 +1,1 @@
84+Error: http://www.jsoniq.org/errors:JNUP0009
85\ No newline at end of file
86
87=== added file 'test/rbkt/Queries/zorba/jsoniq/arr_update_02.xq'
88--- test/rbkt/Queries/zorba/jsoniq/arr_update_02.xq 1970-01-01 00:00:00 +0000
89+++ test/rbkt/Queries/zorba/jsoniq/arr_update_02.xq 2012-07-10 13:06:20 +0000
90@@ -0,0 +1,13 @@
91+import module namespace j = "http://www.jsoniq.org/functions";
92+
93+variable $a := [ 1, 2, 3];
94+
95+(
96+ replace json value of $a(2) with 4,
97+ replace json value of $a(2) with 4,
98+ insert json (5, 6) into $a at position 2,
99+ delete json $a(2),
100+ delete json $a(2)
101+);
102+
103+$a
104
105=== added file 'test/rbkt/Queries/zorba/jsoniq/obj_update_01.xq'
106--- test/rbkt/Queries/zorba/jsoniq/obj_update_01.xq 1970-01-01 00:00:00 +0000
107+++ test/rbkt/Queries/zorba/jsoniq/obj_update_01.xq 2012-07-10 13:06:20 +0000
108@@ -0,0 +1,11 @@
109+import module namespace j = "http://www.jsoniq.org/functions";
110+
111+variable $o := { "foo" : "bar" };
112+
113+(
114+ replace json value of $o("foo") with "bar2",
115+ rename json $o("foo") as "foo2",
116+ insert json { "bar" : "foo" } into $o
117+);
118+
119+$o
120
121=== added file 'test/rbkt/Queries/zorba/jsoniq/obj_update_02.xq'
122--- test/rbkt/Queries/zorba/jsoniq/obj_update_02.xq 1970-01-01 00:00:00 +0000
123+++ test/rbkt/Queries/zorba/jsoniq/obj_update_02.xq 2012-07-10 13:06:20 +0000
124@@ -0,0 +1,12 @@
125+import module namespace j = "http://www.jsoniq.org/functions";
126+
127+variable $o := { "foo" : "bar" };
128+
129+(
130+ replace json value of $o("foo") with "bar2",
131+ rename json $o("foo") as "foo2",
132+ insert json { "bar" : "foo" } into $o,
133+ delete json $o("foo")
134+);
135+
136+$o

Subscribers

People subscribed via source and target branches