Merge lp:~zorba-coders/zorba/bug-1046411 into lp:zorba

Proposed by Markos Zaharioudakis
Status: Merged
Approved by: Markos Zaharioudakis
Approved revision: 11033
Merged at revision: 11033
Proposed branch: lp:~zorba-coders/zorba/bug-1046411
Merge into: lp:zorba
Diff against target: 1135 lines (+488/-139)
31 files modified
ChangeLog (+4/-0)
src/compiler/expression/expr.cpp (+1/-1)
src/compiler/expression/expr.h (+17/-17)
src/compiler/rewriter/rules/type_rules.cpp (+38/-10)
src/compiler/translator/translator.cpp (+52/-50)
src/functions/func_jsoniq_functions_impl.cpp (+82/-40)
src/functions/pregenerated/func_jsoniq_functions.cpp (+28/-0)
src/functions/pregenerated/func_jsoniq_functions.h (+24/-0)
src/functions/pregenerated/function_enum.h (+1/-0)
src/runtime/json/jsoniq_functions_impl.cpp (+40/-0)
src/runtime/json/pregenerated/jsoniq_functions.cpp (+25/-0)
src/runtime/json/pregenerated/jsoniq_functions.h (+34/-0)
src/runtime/pregenerated/iterator_enum.h (+1/-0)
src/runtime/spec/json/jsoniq_functions.xml (+31/-0)
src/runtime/visitors/pregenerated/planiter_visitor.h (+7/-0)
src/runtime/visitors/pregenerated/printer_visitor.cpp (+15/-0)
src/runtime/visitors/pregenerated/printer_visitor.h (+5/-0)
src/store/api/item_factory.h (+11/-0)
src/store/naive/json_items.h (+16/-17)
src/store/naive/simple_item_factory.cpp (+28/-0)
src/store/naive/simple_item_factory.h (+7/-0)
test/rbkt/ExpQueryResults/zorba/jsoniq/arr_replace_01.xml.res (+1/-1)
test/rbkt/ExpQueryResults/zorba/jsoniq/obj_insert_06.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/jsoniq/obj_replace_05.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/jsoniq/pair_value_boxing_01.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/jsoniq/pair_value_boxing_02.xml.res (+1/-0)
test/rbkt/Queries/zorba/jsoniq/arr_replace_01.xq (+2/-1)
test/rbkt/Queries/zorba/jsoniq/jnty0002-1.spec (+0/-1)
test/rbkt/Queries/zorba/jsoniq/jnty0002-2.spec (+0/-1)
test/rbkt/Queries/zorba/jsoniq/obj_insert_06.xq (+5/-0)
test/rbkt/Queries/zorba/jsoniq/obj_replace_05.xq (+9/-0)
To merge this branch: bzr merge lp:~zorba-coders/zorba/bug-1046411
Reviewer Review Type Date Requested Status
Markos Zaharioudakis Approve
Review via email: mp+123654@code.launchpad.net

Commit message

Fixed bug #1046411 (automatic boxing of mutli-item sequence appearing as the value of an object pair)
Fixed bug #1046410 (automatic conversion to null of empty sequence appearing as the value of an object pair)

Description of the change

Fixed bug #1046411 (automatic boxing of mutli-item sequence appearing as the value of an object pair)
Fixed bug #1046410 (automatic conversion to null of empty sequence appearing as the value of an object pair)

To post a comment you must log in.
lp:~zorba-coders/zorba/bug-1046411 updated
11030. By Markos Zaharioudakis

work in progress

11031. By Markos Zaharioudakis

merge from trunk

11032. By Markos Zaharioudakis

work in progress

11033. By Markos Zaharioudakis

added internal json-box function

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 bug-1046411-2012-09-11T16-04-36.756Z 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 'ChangeLog'
2--- ChangeLog 2012-09-11 14:57:18 +0000
3+++ ChangeLog 2012-09-11 15:56:21 +0000
4@@ -27,6 +27,10 @@
5 * Fixed bug #1034942 (improper variable inlining inside general flwor expr)
6 * Fixed bug #1024892 (index declaration references udf declared after the index)
7 * Fixed bug #1038410 (Memory leaks in parser, trace iterator, and general index)
8+ * Fixed bug #1046411 (automatic boxing of mutli-item sequence appearing as the
9+ value of an object pair)
10+ * Fixed bug #1046410 (automatic conversion to null of empty sequence appearing
11+ as the value of an object pair)
12 * Fixed bug #1039488 (inserting more than one pair at once in a JSON object)
13 * Fixed bug #1042840 (qname pool free-list corruption)
14 * Fixed bug #866984 (better error message for an eval error)
15
16=== modified file 'src/compiler/expression/expr.cpp'
17--- src/compiler/expression/expr.cpp 2012-09-10 18:50:57 +0000
18+++ src/compiler/expression/expr.cpp 2012-09-11 15:56:21 +0000
19@@ -943,7 +943,7 @@
20 CompilerCB* ccb,
21 static_context* sctx,
22 const QueryLoc& loc,
23- store::Item_t v)
24+ const store::Item_t& v)
25 :
26 expr(ccb, sctx, loc, const_expr_kind),
27 theValue(v)
28
29=== modified file 'src/compiler/expression/expr.h'
30--- src/compiler/expression/expr.h 2012-09-10 18:50:57 +0000
31+++ src/compiler/expression/expr.h 2012-09-11 15:56:21 +0000
32@@ -784,23 +784,23 @@
33 store::Item_t theValue;
34
35 protected:
36- const_expr(CompilerCB* ccb, static_context* sctx, const QueryLoc&, zstring& sval);
37-
38- const_expr(CompilerCB* ccb, static_context* sctx, const QueryLoc&, const std::string& sval);
39-
40- const_expr(CompilerCB* ccb, static_context* sctx, const QueryLoc&, const char* sval);
41-
42- const_expr(CompilerCB* ccb, static_context* sctx, const QueryLoc&, xs_integer);
43-
44- const_expr(CompilerCB* ccb, static_context* sctx, const QueryLoc&, xs_decimal);
45-
46- const_expr(CompilerCB* ccb, static_context* sctx, const QueryLoc&, xs_double);
47-
48- const_expr(CompilerCB* ccb, static_context* sctx, const QueryLoc&, xs_boolean);
49-
50- const_expr(CompilerCB* ccb, static_context* sctx, const QueryLoc&, store::Item_t);
51-
52- const_expr(CompilerCB* ccb, static_context* sctx, const QueryLoc&, const char* ns, const char* pre, const char* local);
53+ const_expr(CompilerCB*, static_context*, const QueryLoc&, zstring& sval);
54+
55+ const_expr(CompilerCB*, static_context*, const QueryLoc&, const std::string& sval);
56+
57+ const_expr(CompilerCB*, static_context*, const QueryLoc&, const char* sval);
58+
59+ const_expr(CompilerCB*, static_context*, const QueryLoc&, xs_integer);
60+
61+ const_expr(CompilerCB*, static_context*, const QueryLoc&, xs_decimal);
62+
63+ const_expr(CompilerCB*, static_context*, const QueryLoc&, xs_double);
64+
65+ const_expr(CompilerCB*, static_context*, const QueryLoc&, xs_boolean);
66+
67+ const_expr(CompilerCB*, static_context*, const QueryLoc&, const store::Item_t&);
68+
69+ const_expr(CompilerCB*, static_context*, const QueryLoc&, const char* ns, const char* pre, const char* local);
70
71 public:
72 store::Item* get_val() const { return theValue.getp(); }
73
74=== modified file 'src/compiler/rewriter/rules/type_rules.cpp'
75--- src/compiler/rewriter/rules/type_rules.cpp 2012-09-10 18:50:57 +0000
76+++ src/compiler/rewriter/rules/type_rules.cpp 2012-09-11 15:56:21 +0000
77@@ -39,6 +39,8 @@
78
79 #include "diagnostics/assert.h"
80
81+#include "store/api/store.h"
82+#include "store/api/item_factory.h"
83
84 namespace zorba
85 {
86@@ -50,7 +52,10 @@
87 const xqtref_t& t,
88 RewriterContext& rCtx);
89
90-static xqtref_t specialize_numeric(fo_expr* fo, static_context* sctx, RewriterContext& rCtx);
91+static xqtref_t specialize_numeric(
92+ fo_expr* fo,
93+ static_context* sctx,
94+ RewriterContext& rCtx);
95
96 static function* flip_value_cmp(FunctionConsts::FunctionKind kind);
97
98@@ -121,6 +126,25 @@
99 else
100 return NULL;
101 }
102+
103+ if (fo->get_func()->getKind() == FunctionConsts::OP_ZORBA_JSON_BOX_1)
104+ {
105+ expr* arg = fo->get_arg(0);
106+ xqtref_t arg_type = arg->get_return_type();
107+
108+ if (arg_type->get_quantifier() == TypeConstants::QUANT_ONE)
109+ return arg;
110+
111+ if (arg_type->max_card() == 0)
112+ {
113+ store::Item_t null;
114+ GENV_STORE.getItemFactory()->createJSONNull(null);
115+
116+ return rCtx.theEM->create_const_expr(sctx, fo->get_loc(), null);
117+ }
118+
119+ return NULL;
120+ }
121 }
122
123 cast_base_expr* pe = NULL;
124@@ -425,16 +449,16 @@
125
126 bool modified = false;
127
128- ulong numClauses = flworExpr->num_clauses();
129- for (ulong i = 0; i < numClauses; ++i)
130+ csize numClauses = flworExpr->num_clauses();
131+ for (csize i = 0; i < numClauses; ++i)
132 {
133 if (flworExpr->get_clause(i)->get_kind() == flwor_clause::order_clause)
134 {
135 orderby_clause* obc = reinterpret_cast<orderby_clause*>
136 (flworExpr->get_clause(i));
137
138- ulong numColumns = obc->num_columns();
139- for (ulong j = 0; j < numColumns; ++j)
140+ csize numColumns = obc->num_columns();
141+ for (csize j = 0; j < numColumns; ++j)
142 {
143 expr* colExpr = obc->get_column_expr(j);
144 xqtref_t colType = colExpr->get_return_type();
145@@ -443,10 +467,11 @@
146 if (!TypeOps::is_equal(tm, *colType, *rtm.EMPTY_TYPE, colLoc) &&
147 TypeOps::is_subtype(tm, *colType, *rtm.UNTYPED_ATOMIC_TYPE_STAR, colLoc))
148 {
149- expr* castExpr = rCtx.theEM->create_cast_expr(colExpr->get_sctx(),
150- colExpr->get_loc(),
151- colExpr,
152- rtm.STRING_TYPE_QUESTION);
153+ expr* castExpr = rCtx.theEM->
154+ create_cast_expr(colExpr->get_sctx(),
155+ colExpr->get_loc(),
156+ colExpr,
157+ rtm.STRING_TYPE_QUESTION);
158
159 obc->set_column_expr(j, castExpr);
160 modified = true;
161@@ -463,7 +488,10 @@
162 }
163
164
165-static xqtref_t specialize_numeric(fo_expr* fo, static_context* sctx, RewriterContext& rCtx)
166+static xqtref_t specialize_numeric(
167+ fo_expr* fo,
168+ static_context* sctx,
169+ RewriterContext& rCtx)
170 {
171 TypeManager* tm = fo->get_type_manager();
172
173
174=== modified file 'src/compiler/translator/translator.cpp'
175--- src/compiler/translator/translator.cpp 2012-09-10 18:50:57 +0000
176+++ src/compiler/translator/translator.cpp 2012-09-11 15:56:21 +0000
177@@ -10058,7 +10058,7 @@
178
179 rchandle<QName> qname = v.get_fname();
180
181- ulong numArgs = 0;
182+ csize numArgs = 0;
183 if (v.get_arg_list() != NULL)
184 numArgs = v.get_arg_list()->size();
185
186@@ -10113,9 +10113,9 @@
187 }
188 }
189
190- size_t numParams = f->getArity();
191+ csize numParams = f->getArity();
192
193- for (ulong i = 0; i < numParams; ++i)
194+ for (csize i = 0; i < numParams; ++i)
195 {
196 xqtref_t type = sign[i];
197 if (!TypeOps::is_in_scope(tm, *type))
198@@ -10178,7 +10178,7 @@
199 arguments.push_back(argExpr);
200 }
201
202- ulong numArgs = (ulong)arguments.size();
203+ csize numArgs = arguments.size();
204
205 function* f = lookup_fn(qname, numArgs, loc);
206
207@@ -10195,20 +10195,34 @@
208 {
209 case FunctionConsts::FN_HEAD_1:
210 {
211- arguments.push_back(theExprManager->create_const_expr(theRootSctx, loc, xs_integer::one()));
212- arguments.push_back(theExprManager->create_const_expr(theRootSctx, loc, xs_integer::one()));
213+ arguments.push_back(theExprManager->
214+ create_const_expr(theRootSctx, loc, xs_integer::one()));
215+
216+ arguments.push_back(theExprManager->
217+ create_const_expr(theRootSctx, loc, xs_integer::one()));
218+
219 function* f = GET_BUILTIN_FUNCTION(OP_ZORBA_SUBSEQUENCE_INT_3);
220- fo_expr* foExpr = theExprManager->create_fo_expr(theRootSctx, loc, f, arguments);
221+
222+ fo_expr* foExpr = theExprManager->
223+ create_fo_expr(theRootSctx, loc, f, arguments);
224+
225 normalize_fo(foExpr);
226+
227 push_nodestack(foExpr);
228 return;
229 }
230 case FunctionConsts::FN_TAIL_1:
231 {
232- arguments.push_back(theExprManager->create_const_expr(theRootSctx, loc, xs_integer(2)));
233+ arguments.push_back(theExprManager->
234+ create_const_expr(theRootSctx, loc, xs_integer(2)));
235+
236 function* f = GET_BUILTIN_FUNCTION(OP_ZORBA_SUBSEQUENCE_INT_2);
237- fo_expr* foExpr = theExprManager->create_fo_expr(theRootSctx, loc, f, arguments);
238+
239+ fo_expr* foExpr = theExprManager->
240+ create_fo_expr(theRootSctx, loc, f, arguments);
241+
242 normalize_fo(foExpr);
243+
244 push_nodestack(foExpr);
245 return;
246 }
247@@ -10223,9 +10237,9 @@
248
249 if (numArgs == 2)
250 {
251- if (TypeOps::is_subtype(tm, *posType, *GENV_TYPESYSTEM.INTEGER_TYPE_STAR, loc))
252+ if (TypeOps::is_subtype(tm, *posType, *theRTM.INTEGER_TYPE_STAR, loc))
253 {
254- if(f->getKind() == FunctionConsts::FN_SUBSTRING_2)
255+ if (f->getKind() == FunctionConsts::FN_SUBSTRING_2)
256 f = GET_BUILTIN_FUNCTION(OP_SUBSTRING_INT_2);
257 else
258 f = GET_BUILTIN_FUNCTION(OP_ZORBA_SUBSEQUENCE_INT_2);
259@@ -10235,17 +10249,19 @@
260 {
261 xqtref_t lenType = arguments[2]->get_return_type();
262
263- if (TypeOps::is_subtype(tm, *posType, *GENV_TYPESYSTEM.INTEGER_TYPE_STAR, loc) &&
264- TypeOps::is_subtype(tm, *lenType, *GENV_TYPESYSTEM.INTEGER_TYPE_STAR, loc))
265+ if (TypeOps::is_subtype(tm, *posType, *theRTM.INTEGER_TYPE_STAR, loc) &&
266+ TypeOps::is_subtype(tm, *lenType, *theRTM.INTEGER_TYPE_STAR, loc))
267 {
268- if(f->getKind() == FunctionConsts::FN_SUBSTRING_3)
269+ if (f->getKind() == FunctionConsts::FN_SUBSTRING_3)
270 f = GET_BUILTIN_FUNCTION(OP_SUBSTRING_INT_3);
271 else
272 f = GET_BUILTIN_FUNCTION(OP_ZORBA_SUBSEQUENCE_INT_3);
273 }
274 }
275
276- fo_expr* foExpr = theExprManager->create_fo_expr(theRootSctx, loc, f, arguments);
277+ fo_expr* foExpr = theExprManager->
278+ create_fo_expr(theRootSctx, loc, f, arguments);
279+
280 normalize_fo(foExpr);
281 push_nodestack(foExpr);
282 return;
283@@ -10290,7 +10306,7 @@
284
285 expr* data_expr = wrap_in_atomization(arguments[0]);
286
287- push_nodestack(&*wrap_in_let_flwor(theExprManager->create_treat_expr(theRootSctx,
288+ push_nodestack(wrap_in_let_flwor(theExprManager->create_treat_expr(theRootSctx,
289 loc,
290 data_expr,
291 theRTM.ANY_ATOMIC_TYPE_QUESTION,
292@@ -10314,7 +10330,7 @@
293 push_nodestack(theExprManager->create_cast_expr(theRootSctx,
294 loc,
295 theExprManager->create_const_expr(theRootSctx, loc, baseuri),
296- GENV_TYPESYSTEM.ANY_URI_TYPE_ONE));
297+ theRTM.ANY_URI_TYPE_ONE));
298 return;
299 }
300 case FunctionConsts::FN_ID_1:
301@@ -10421,7 +10437,9 @@
302
303 if (f != NULL && f->getKind() == FunctionConsts::FN_APPLY_1)
304 {
305- expr* applyExpr = theExprManager->create_apply_expr(theRootSctx, loc, arguments[0], false);
306+ expr* applyExpr = theExprManager->
307+ create_apply_expr(theRootSctx, loc, arguments[0], false);
308+
309 push_nodestack(applyExpr);
310 return;
311 }
312@@ -10452,7 +10470,7 @@
313 }
314 }
315
316- numArgs = (ulong)arguments.size(); // recompute size
317+ numArgs = arguments.size(); // recompute size
318
319 // Check if this is a call to a type constructor function
320 xqtref_t type = CTX_TM->create_named_type(qnameItem,
321@@ -11361,7 +11379,8 @@
322 /*******************************************************************************
323 PairConstructor ::= ExprSingle ":" ExprSingle
324
325- The PairConstructor production can appear only on the RHS of a DirectObjectConstructor
326+ The PairConstructor production can appear only on the RHS of a
327+ DirectObjectConstructor or in the source list of a JSONObjectInsertExpr
328
329 The 1st ExprSingle must return exactly one string.
330 The 2nd ExprSingle must contain exactly one item of any kind.
331@@ -11396,13 +11415,10 @@
332 NULL);
333
334 valueExpr = theExprManager->
335- create_treat_expr(theRootSctx,
336- valueExpr->get_loc(),
337- valueExpr,
338- GENV_TYPESYSTEM.ITEM_TYPE_ONE,
339- TreatIterator::JSONIQ_VALUE, // JNTY0002
340- false,
341- NULL);
342+ create_fo_expr(theRootSctx,
343+ valueExpr->get_loc(),
344+ GET_BUILTIN_FUNCTION(OP_ZORBA_JSON_BOX_1),
345+ valueExpr);
346
347 push_nodestack(valueExpr);
348 push_nodestack(nameExpr);
349@@ -11758,10 +11774,8 @@
350 }
351 else
352 {
353- fo_expr* expr_list = theExprManager->create_fo_expr(theRootSctx,
354- loc,
355- op_concatenate,
356- args);
357+ fo_expr* expr_list = theExprManager->
358+ create_fo_expr(theRootSctx, loc, op_concatenate, args);
359
360 normalize_fo(expr_list);
361
362@@ -11937,10 +11951,9 @@
363 }
364 else if (args.size() > 1)
365 {
366- fo_expr* expr_list = theExprManager->create_fo_expr(theRootSctx,
367- loc,
368- op_concatenate,
369- args);
370+ fo_expr* expr_list = theExprManager->
371+ create_fo_expr(theRootSctx, loc, op_concatenate, args);
372+
373 normalize_fo(expr_list);
374
375 push_nodestack(expr_list);
376@@ -13148,16 +13161,6 @@
377 expr* nameExpr = pop_nodestack();
378 expr* valueExpr = pop_nodestack();
379
380- nameExpr = wrap_in_type_promotion(nameExpr,
381- theRTM.STRING_TYPE_ONE,
382- PromoteIterator::JSONIQ_OBJECT_SELECTOR); // JNUP0007
383-
384- valueExpr = wrap_in_type_match(valueExpr,
385- rtm.ITEM_TYPE_ONE,
386- loc,
387- TreatIterator::JSONIQ_OBJECT_UPDATE_VALUE, // JNUP0017
388- NULL);
389-
390 args[2 * (numPairs - 1 - i) + 1] = nameExpr;
391 args[2 * (numPairs - 1 - i) + 2] = valueExpr;
392 }
393@@ -13358,11 +13361,10 @@
394 PromoteIterator::JSONIQ_SELECTOR, // JNUP0007
395 NULL);
396
397- args[2] = wrap_in_type_match(valueExpr,
398- theRTM.ITEM_TYPE_ONE,
399- loc,
400- TreatIterator::JSONIQ_OBJECT_UPDATE_VALUE, // JNUP0017
401- NULL);
402+ args[2] = theExprManager->create_fo_expr(theRootSctx,
403+ valueExpr->get_loc(),
404+ GET_BUILTIN_FUNCTION(OP_ZORBA_JSON_BOX_1),
405+ valueExpr);
406
407 fo_expr* updExpr = theExprManager->
408 create_fo_expr(theRootSctx,
409
410=== modified file 'src/functions/func_jsoniq_functions_impl.cpp'
411--- src/functions/func_jsoniq_functions_impl.cpp 2012-09-10 18:50:57 +0000
412+++ src/functions/func_jsoniq_functions_impl.cpp 2012-09-11 15:56:21 +0000
413@@ -45,7 +45,8 @@
414
415 static_context* sctx = fo->get_sctx();
416
417- if (sctx->preserve_mode() != StaticContextConsts::no_preserve_ns)
418+ if (sctx->preserve_mode() != StaticContextConsts::no_preserve_ns ||
419+ sctx->construction_mode() != StaticContextConsts::cons_preserve)
420 {
421 return true;
422 }
423@@ -70,8 +71,11 @@
424 ********************************************************************************/
425 bool op_zorba_json_array_insert::mustCopyInputNodes(expr* fo, csize producer) const
426 {
427+ static_context* sctx = fo->get_sctx();
428+
429 if (producer == 2 &&
430- fo->get_sctx()->preserve_mode() != StaticContextConsts::no_preserve_ns)
431+ (sctx->preserve_mode() != StaticContextConsts::no_preserve_ns ||
432+ sctx->construction_mode() != StaticContextConsts::cons_preserve))
433 {
434 return true;
435 }
436@@ -85,31 +89,17 @@
437 ********************************************************************************/
438 bool op_zorba_json_replace_value::mustCopyInputNodes(expr* fo, csize producer) const
439 {
440- if (producer == 2 &&
441- fo->get_sctx()->preserve_mode() != StaticContextConsts::no_preserve_ns)
442- {
443- return true;
444- }
445-
446- return false;
447-}
448-
449-
450-
451-/*******************************************************************************
452-
453-********************************************************************************/
454-bool op_zorba_json_array_append::mustCopyInputNodes(expr* fo, csize producer) const
455-{
456- if (producer == 2 &&
457- fo->get_sctx()->preserve_mode() != StaticContextConsts::no_preserve_ns)
458- {
459- return true;
460- }
461-
462- return false;
463-}
464-
465+ static_context* sctx = fo->get_sctx();
466+
467+ if (producer == 2 &&
468+ (sctx->preserve_mode() != StaticContextConsts::no_preserve_ns ||
469+ sctx->construction_mode() != StaticContextConsts::cons_preserve))
470+ {
471+ return true;
472+ }
473+
474+ return false;
475+}
476
477
478 /*******************************************************************************
479@@ -129,6 +119,60 @@
480 /*******************************************************************************
481
482 ********************************************************************************/
483+bool op_zorba_json_array_append::mustCopyInputNodes(expr* fo, csize producer) const
484+{
485+ static_context* sctx = fo->get_sctx();
486+
487+ if (producer == 2 &&
488+ (sctx->preserve_mode() != StaticContextConsts::no_preserve_ns ||
489+ sctx->construction_mode() != StaticContextConsts::cons_preserve))
490+ {
491+ return true;
492+ }
493+
494+ return false;
495+}
496+
497+
498+#if 1
499+/*******************************************************************************
500+
501+********************************************************************************/
502+bool op_zorba_json_box::mustCopyInputNodes(expr* fo, csize producer) const
503+{
504+ static_context* sctx = fo->get_sctx();
505+
506+ if (sctx->preserve_mode() != StaticContextConsts::no_preserve_ns ||
507+ sctx->construction_mode() != StaticContextConsts::cons_preserve)
508+ {
509+ return true;
510+ }
511+
512+ return false;
513+}
514+
515+
516+/*******************************************************************************
517+
518+********************************************************************************/
519+xqtref_t op_zorba_json_box::getReturnType(const fo_expr* fo) const
520+{
521+ xqtref_t type = fo->get_arg(0)->get_return_type();
522+
523+ if (type->get_quantifier() == TypeConstants::QUANT_ONE)
524+ return type;
525+
526+ if (type->max_card() == 0)
527+ return GENV_TYPESYSTEM.JDM_NULL_TYPE_ONE;
528+
529+ return theSignature.returnType();
530+}
531+#endif
532+
533+
534+/*******************************************************************************
535+
536+********************************************************************************/
537 PlanIter_t fn_jsoniq_parse_json::codegen(
538 CompilerCB*,
539 static_context* sctx,
540@@ -160,26 +204,24 @@
541 std::vector<PlanIter_t>& argv,
542 expr& ann) const
543 {
544- return new JSONObjectIterator(sctx, loc, argv, true, false);
545+ return new JSONObjectIterator(sctx, loc, argv, true, false);
546 }
547
548
549 void populate_context_jsoniq_functions_impl(static_context* sctx)
550 {
551 DECL(sctx, op_zorba_object_insert,
552- (createQName("http://www.zorba-xquery.com/internal/zorba-ops",
553- "",
554- "object-insert"),
555- GENV_TYPESYSTEM.JSON_OBJECT_TYPE_ONE,
556- true,
557- GENV_TYPESYSTEM.EMPTY_TYPE));
558-
559+ (createQName("http://www.zorba-xquery.com/internal/zorba-ops",
560+ "",
561+ "object-insert"),
562+ GENV_TYPESYSTEM.JSON_OBJECT_TYPE_ONE,
563+ true,
564+ GENV_TYPESYSTEM.EMPTY_TYPE));
565+
566 DECL(sctx, jn_object,
567- (createQName("http://www.jsoniq.org/functions",
568- "",
569- "object"),
570- GENV_TYPESYSTEM.JSON_OBJECT_TYPE_STAR,
571- GENV_TYPESYSTEM.JSON_OBJECT_TYPE_ONE));
572+ (createQName("http://www.jsoniq.org/functions", "", "object"),
573+ GENV_TYPESYSTEM.JSON_OBJECT_TYPE_STAR,
574+ GENV_TYPESYSTEM.JSON_OBJECT_TYPE_ONE));
575 }
576
577
578
579=== modified file 'src/functions/pregenerated/func_jsoniq_functions.cpp'
580--- src/functions/pregenerated/func_jsoniq_functions.cpp 2012-09-11 14:57:18 +0000
581+++ src/functions/pregenerated/func_jsoniq_functions.cpp 2012-09-11 15:56:21 +0000
582@@ -192,6 +192,18 @@
583 }
584
585 #endif
586+#ifdef ZORBA_WITH_JSON
587+PlanIter_t op_zorba_json_box::codegen(
588+ CompilerCB*,
589+ static_context* sctx,
590+ const QueryLoc& loc,
591+ std::vector<PlanIter_t>& argv,
592+ expr& ann) const
593+{
594+ return new JSONBoxIterator(sctx, loc, argv[0]);
595+}
596+
597+#endif
598
599 void populate_context_jsoniq_functions(static_context* sctx)
600 {
601@@ -462,6 +474,22 @@
602
603
604 #endif
605+
606+
607+#ifdef ZORBA_WITH_JSON
608+
609+
610+ {
611+ DECL_WITH_KIND(sctx, op_zorba_json_box,
612+ (createQName("http://www.zorba-xquery.com/internal/zorba-ops","","json-box"),
613+ GENV_TYPESYSTEM.ITEM_TYPE_STAR,
614+ GENV_TYPESYSTEM.ITEM_TYPE_ONE),
615+ FunctionConsts::OP_ZORBA_JSON_BOX_1);
616+
617+ }
618+
619+
620+#endif
621 }
622
623
624
625=== modified file 'src/functions/pregenerated/func_jsoniq_functions.h'
626--- src/functions/pregenerated/func_jsoniq_functions.h 2012-09-10 18:50:57 +0000
627+++ src/functions/pregenerated/func_jsoniq_functions.h 2012-09-11 15:56:21 +0000
628@@ -338,6 +338,30 @@
629 CODEGEN_DECL();
630 };
631 #endif
632+#ifdef ZORBA_WITH_JSON
633+
634+//op-zorba:json-box
635+class op_zorba_json_box : public function
636+{
637+public:
638+ op_zorba_json_box(const signature& sig, FunctionConsts::FunctionKind kind)
639+ :
640+ function(sig, kind)
641+ {
642+
643+ }
644+
645+ xqtref_t getReturnType(const fo_expr* caller) const;
646+
647+ bool accessesDynCtx() const { return true; }
648+
649+ bool propagatesInputNodes(expr* fo, csize producer) const { return true; }
650+
651+ bool mustCopyInputNodes(expr* fo, csize producer) const;
652+
653+ CODEGEN_DECL();
654+};
655+#endif
656
657
658 } //namespace zorba
659
660=== modified file 'src/functions/pregenerated/function_enum.h'
661--- src/functions/pregenerated/function_enum.h 2012-09-11 14:57:18 +0000
662+++ src/functions/pregenerated/function_enum.h 2012-09-11 15:56:21 +0000
663@@ -241,6 +241,7 @@
664 OP_ZORBA_JSON_REPLACE_VALUE_3,
665 OP_ZORBA_JSON_RENAME_3,
666 OP_ZORBA_JSON_ARRAY_APPEND_2,
667+ OP_ZORBA_JSON_BOX_1,
668 MATH_SQRT_1,
669 MATH_EXP_1,
670 MATH_EXP10_1,
671
672=== modified file 'src/runtime/json/jsoniq_functions_impl.cpp'
673--- src/runtime/json/jsoniq_functions_impl.cpp 2012-09-11 14:57:18 +0000
674+++ src/runtime/json/jsoniq_functions_impl.cpp 2012-09-11 15:56:21 +0000
675@@ -26,6 +26,7 @@
676 #include "runtime/json/jsoniq_functions.h"
677 #include "runtime/json/jsoniq_functions_impl.h"
678 #include "runtime/visitors/planiter_visitor.h"
679+#include "runtime/api/plan_iterator_wrapper.h"
680
681 #include "diagnostics/diagnostic.h"
682 #include "diagnostics/xquery_diagnostics.h"
683@@ -913,6 +914,45 @@
684 }
685
686
687+/*******************************************************************************
688+
689+********************************************************************************/
690+bool JSONBoxIterator::nextImpl(
691+ store::Item_t& result,
692+ PlanState& planState) const
693+{
694+ store::Item_t value1;
695+ store::Item_t value2;
696+ store::Item_t value;
697+
698+ PlanIteratorState* state;
699+ DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
700+
701+ if (!consumeNext(value1, theChild, planState))
702+ {
703+ GENV_STORE.getItemFactory()->createJSONNull(result);
704+ }
705+ else if (!consumeNext(value2, theChild, planState))
706+ {
707+ result.transfer(value1);
708+ }
709+ else
710+ {
711+ store::CopyMode copymode;
712+ copymode.set(false, true, true, true);
713+
714+ store::Iterator_t wrapper = new PlanIteratorWrapper(theChild, planState);
715+
716+ GENV_STORE.getItemFactory()->
717+ createJSONArray(result, value1, value2, wrapper, copymode);
718+ }
719+
720+ STACK_PUSH(true, state);
721+ STACK_END(state);
722+}
723+
724+
725 } /* namespace zorba */
726 /* vim:set et sw=2 ts=2: */
727+
728 #endif /* ZORBA_WITH_JSON */
729
730=== modified file 'src/runtime/json/pregenerated/jsoniq_functions.cpp'
731--- src/runtime/json/pregenerated/jsoniq_functions.cpp 2012-09-11 14:57:18 +0000
732+++ src/runtime/json/pregenerated/jsoniq_functions.cpp 2012-09-11 15:56:21 +0000
733@@ -473,6 +473,31 @@
734 // </JSONArrayAppendIterator>
735
736 #endif
737+#ifdef ZORBA_WITH_JSON
738+// <JSONBoxIterator>
739+SERIALIZABLE_CLASS_VERSIONS(JSONBoxIterator)
740+
741+void JSONBoxIterator::serialize(::zorba::serialization::Archiver& ar)
742+{
743+ serialize_baseclass(ar,
744+ (UnaryBaseIterator<JSONBoxIterator, PlanIteratorState>*)this);
745+}
746+
747+
748+void JSONBoxIterator::accept(PlanIterVisitor& v) const
749+{
750+ v.beginVisit(*this);
751+
752+ theChild->accept(v);
753+
754+ v.endVisit(*this);
755+}
756+
757+JSONBoxIterator::~JSONBoxIterator() {}
758+
759+// </JSONBoxIterator>
760+
761+#endif
762
763 }
764
765
766=== modified file 'src/runtime/json/pregenerated/jsoniq_functions.h'
767--- src/runtime/json/pregenerated/jsoniq_functions.h 2012-09-11 14:57:18 +0000
768+++ src/runtime/json/pregenerated/jsoniq_functions.h 2012-09-11 15:56:21 +0000
769@@ -586,6 +586,40 @@
770
771 #endif
772
773+#ifdef ZORBA_WITH_JSON
774+/**
775+ *
776+ *
777+ *
778+ * Author: Zorba Team
779+ */
780+class JSONBoxIterator : public UnaryBaseIterator<JSONBoxIterator, PlanIteratorState>
781+{
782+public:
783+ SERIALIZABLE_CLASS(JSONBoxIterator);
784+
785+ SERIALIZABLE_CLASS_CONSTRUCTOR2T(JSONBoxIterator,
786+ UnaryBaseIterator<JSONBoxIterator, PlanIteratorState>);
787+
788+ void serialize( ::zorba::serialization::Archiver& ar);
789+
790+ JSONBoxIterator(
791+ static_context* sctx,
792+ const QueryLoc& loc,
793+ PlanIter_t& child)
794+ :
795+ UnaryBaseIterator<JSONBoxIterator, PlanIteratorState>(sctx, loc, child)
796+ {}
797+
798+ virtual ~JSONBoxIterator();
799+
800+ void accept(PlanIterVisitor& v) const;
801+
802+ bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
803+};
804+
805+#endif
806+
807 }
808 #endif
809 /*
810
811=== modified file 'src/runtime/pregenerated/iterator_enum.h'
812--- src/runtime/pregenerated/iterator_enum.h 2012-09-10 18:50:57 +0000
813+++ src/runtime/pregenerated/iterator_enum.h 2012-09-11 15:56:21 +0000
814@@ -166,6 +166,7 @@
815 TYPE_JSONReplaceValueIterator,
816 TYPE_JSONRenameIterator,
817 TYPE_JSONArrayAppendIterator,
818+ TYPE_JSONBoxIterator,
819 TYPE_SqrtIterator,
820 TYPE_ExpIterator,
821 TYPE_Exp10Iterator,
822
823=== modified file 'src/runtime/spec/json/jsoniq_functions.xml'
824--- src/runtime/spec/json/jsoniq_functions.xml 2012-09-11 14:57:18 +0000
825+++ src/runtime/spec/json/jsoniq_functions.xml 2012-09-11 15:56:21 +0000
826@@ -479,4 +479,35 @@
827
828 </zorba:iterator>
829
830+
831+<!--
832+/*******************************************************************************
833+********************************************************************************/
834+-->
835+<zorba:iterator name="JSONBoxIterator"
836+ arity="unary"
837+ preprocessorGuard="#ifdef ZORBA_WITH_JSON">
838+
839+ <zorba:description author="Zorba Team">
840+
841+ </zorba:description>
842+ internal function
843+ <zorba:function>
844+
845+ <zorba:signature localname="json-box" prefix="op-zorba">
846+ <zorba:param>item()*</zorba:param>
847+ <zorba:output>item()</zorba:output>
848+ </zorba:signature>
849+
850+ <zorba:methods>
851+ <zorba:getReturnType/>
852+ <zorba:accessesDynCtx returnValue="true"/>
853+ <zorba:propagatesInputNodes value="true"/>
854+ <zorba:mustCopyInputNodes/>
855+ </zorba:methods>
856+
857+ </zorba:function>
858+
859+</zorba:iterator>
860+
861 </zorba:iterators>
862
863=== modified file 'src/runtime/visitors/pregenerated/planiter_visitor.h'
864--- src/runtime/visitors/pregenerated/planiter_visitor.h 2012-09-10 18:50:57 +0000
865+++ src/runtime/visitors/pregenerated/planiter_visitor.h 2012-09-11 15:56:21 +0000
866@@ -353,6 +353,9 @@
867 #ifdef ZORBA_WITH_JSON
868 class JSONArrayAppendIterator;
869 #endif
870+#ifdef ZORBA_WITH_JSON
871+ class JSONBoxIterator;
872+#endif
873 class SqrtIterator;
874
875 class ExpIterator;
876@@ -1193,6 +1196,10 @@
877 virtual void beginVisit ( const JSONArrayAppendIterator& ) = 0;
878 virtual void endVisit ( const JSONArrayAppendIterator& ) = 0;
879 #endif
880+#ifdef ZORBA_WITH_JSON
881+ virtual void beginVisit ( const JSONBoxIterator& ) = 0;
882+ virtual void endVisit ( const JSONBoxIterator& ) = 0;
883+#endif
884 virtual void beginVisit ( const SqrtIterator& ) = 0;
885 virtual void endVisit ( const SqrtIterator& ) = 0;
886
887
888=== modified file 'src/runtime/visitors/pregenerated/printer_visitor.cpp'
889--- src/runtime/visitors/pregenerated/printer_visitor.cpp 2012-09-10 18:50:57 +0000
890+++ src/runtime/visitors/pregenerated/printer_visitor.cpp 2012-09-11 15:56:21 +0000
891@@ -2188,6 +2188,21 @@
892 // </JSONArrayAppendIterator>
893
894 #endif
895+#ifdef ZORBA_WITH_JSON
896+// <JSONBoxIterator>
897+void PrinterVisitor::beginVisit ( const JSONBoxIterator& a) {
898+ thePrinter.startBeginVisit("JSONBoxIterator", ++theId);
899+ printCommons( &a, theId );
900+ thePrinter.endBeginVisit( theId );
901+}
902+
903+void PrinterVisitor::endVisit ( const JSONBoxIterator& ) {
904+ thePrinter.startEndVisit();
905+ thePrinter.endEndVisit();
906+}
907+// </JSONBoxIterator>
908+
909+#endif
910
911 // <SqrtIterator>
912 void PrinterVisitor::beginVisit ( const SqrtIterator& a) {
913
914=== modified file 'src/runtime/visitors/pregenerated/printer_visitor.h'
915--- src/runtime/visitors/pregenerated/printer_visitor.h 2012-09-10 18:50:57 +0000
916+++ src/runtime/visitors/pregenerated/printer_visitor.h 2012-09-11 15:56:21 +0000
917@@ -547,6 +547,11 @@
918 void endVisit ( const JSONArrayAppendIterator& );
919 #endif
920
921+#ifdef ZORBA_WITH_JSON
922+ void beginVisit( const JSONBoxIterator& );
923+ void endVisit ( const JSONBoxIterator& );
924+#endif
925+
926 void beginVisit( const SqrtIterator& );
927 void endVisit ( const SqrtIterator& );
928
929
930=== modified file 'src/store/api/item_factory.h'
931--- src/store/api/item_factory.h 2012-09-10 18:50:57 +0000
932+++ src/store/api/item_factory.h 2012-09-11 15:56:21 +0000
933@@ -717,6 +717,17 @@
934 const std::vector<CopyMode>& copyModes) = 0;
935
936 /**
937+ * This method is used when we want to box a sequence of item into an array,
938+ * but only if the sequence has more than 1 items.
939+ */
940+ virtual bool createJSONArray(
941+ Item_t& result,
942+ Item_t& item1,
943+ Item_t& item2,
944+ const Iterator_t& source,
945+ const CopyMode& copyMode) = 0;
946+
947+ /**
948 * This method is used by the public API only
949 */
950 virtual bool createJSONArray(
951
952=== modified file 'src/store/naive/json_items.h'
953--- src/store/naive/json_items.h 2012-09-10 18:50:57 +0000
954+++ src/store/naive/json_items.h 2012-09-11 15:56:21 +0000
955@@ -395,23 +395,22 @@
956
957 class ValuesIterator : public store::Iterator
958 {
959- protected:
960- SimpleJSONArray_t theArray;
961- Members::iterator theIter;
962-
963- public:
964- ValuesIterator(const SimpleJSONArray_t& anArray)
965- : theArray(anArray) {}
966-
967- virtual ~ValuesIterator();
968-
969- virtual void open();
970-
971- virtual bool next(store::Item_t&);
972-
973- virtual void reset();
974-
975- virtual void close();
976+ protected:
977+ SimpleJSONArray_t theArray;
978+ Members::iterator theIter;
979+
980+ public:
981+ ValuesIterator(const SimpleJSONArray_t& anArray) : theArray(anArray) {}
982+
983+ virtual ~ValuesIterator();
984+
985+ virtual void open();
986+
987+ virtual bool next(store::Item_t&);
988+
989+ virtual void reset();
990+
991+ virtual void close();
992 };
993
994 private:
995
996=== modified file 'src/store/naive/simple_item_factory.cpp'
997--- src/store/naive/simple_item_factory.cpp 2012-09-10 18:50:57 +0000
998+++ src/store/naive/simple_item_factory.cpp 2012-09-11 15:56:21 +0000
999@@ -2121,6 +2121,34 @@
1000
1001 bool BasicItemFactory::createJSONArray(
1002 store::Item_t& result,
1003+ store::Item_t& item1,
1004+ store::Item_t& item2,
1005+ const store::Iterator_t& source,
1006+ const store::CopyMode& copymode)
1007+{
1008+ result = new json::SimpleJSONArray();
1009+
1010+ json::SimpleJSONArray* array = static_cast<json::SimpleJSONArray*>(result.getp());
1011+
1012+ array->push_back(item1);
1013+ array->push_back(item2);
1014+
1015+ store::Item_t item;
1016+
1017+ while (source->next(item))
1018+ {
1019+ if (copymode.theDoCopy && (item->isNode() || item->isJSONItem()))
1020+ item = item->copy(NULL, copymode);
1021+
1022+ array->push_back(item);
1023+ }
1024+
1025+ return true;
1026+}
1027+
1028+
1029+bool BasicItemFactory::createJSONArray(
1030+ store::Item_t& result,
1031 const std::vector<store::Item_t>& items)
1032 {
1033 result = new json::SimpleJSONArray();
1034
1035=== modified file 'src/store/naive/simple_item_factory.h'
1036--- src/store/naive/simple_item_factory.h 2012-09-10 18:50:57 +0000
1037+++ src/store/naive/simple_item_factory.h 2012-09-11 15:56:21 +0000
1038@@ -413,6 +413,13 @@
1039
1040 bool createJSONArray(
1041 store::Item_t& result,
1042+ store::Item_t& item1,
1043+ store::Item_t& item2,
1044+ const store::Iterator_t& source,
1045+ const store::CopyMode& copyMode);
1046+
1047+ bool createJSONArray(
1048+ store::Item_t& result,
1049 const std::vector<store::Item_t>& items);
1050
1051 bool createJSONObject(
1052
1053=== modified file 'test/rbkt/ExpQueryResults/zorba/jsoniq/arr_replace_01.xml.res'
1054--- test/rbkt/ExpQueryResults/zorba/jsoniq/arr_replace_01.xml.res 2012-03-22 20:59:50 +0000
1055+++ test/rbkt/ExpQueryResults/zorba/jsoniq/arr_replace_01.xml.res 2012-09-11 15:56:21 +0000
1056@@ -1,1 +1,1 @@
1057-{ "foo" : [ 1, 2, 3 ] }[ { "foo" : "bar" }, 2, 4 ]
1058+{ "foo" : [ 1, 2, 3 ] }[ { "foo" : "bar" }, [ 1, 2 ], 4 ]
1059
1060=== added file 'test/rbkt/ExpQueryResults/zorba/jsoniq/obj_insert_06.xml.res'
1061--- test/rbkt/ExpQueryResults/zorba/jsoniq/obj_insert_06.xml.res 1970-01-01 00:00:00 +0000
1062+++ test/rbkt/ExpQueryResults/zorba/jsoniq/obj_insert_06.xml.res 2012-09-11 15:56:21 +0000
1063@@ -0,0 +1,1 @@
1064+{ "foo" : [ "bar1", "bar2" ], "blub" : null }
1065
1066=== added file 'test/rbkt/ExpQueryResults/zorba/jsoniq/obj_replace_05.xml.res'
1067--- test/rbkt/ExpQueryResults/zorba/jsoniq/obj_replace_05.xml.res 1970-01-01 00:00:00 +0000
1068+++ test/rbkt/ExpQueryResults/zorba/jsoniq/obj_replace_05.xml.res 2012-09-11 15:56:21 +0000
1069@@ -0,0 +1,1 @@
1070+{ "foo" : [ [ 1, 2, 3 ], 10, 100, 1000 ] }
1071
1072=== added file 'test/rbkt/ExpQueryResults/zorba/jsoniq/pair_value_boxing_01.xml.res'
1073--- test/rbkt/ExpQueryResults/zorba/jsoniq/pair_value_boxing_01.xml.res 1970-01-01 00:00:00 +0000
1074+++ test/rbkt/ExpQueryResults/zorba/jsoniq/pair_value_boxing_01.xml.res 2012-09-11 15:56:21 +0000
1075@@ -0,0 +1,1 @@
1076+{ "foo" : [ "bar", "bar" ] }
1077
1078=== added file 'test/rbkt/ExpQueryResults/zorba/jsoniq/pair_value_boxing_02.xml.res'
1079--- test/rbkt/ExpQueryResults/zorba/jsoniq/pair_value_boxing_02.xml.res 1970-01-01 00:00:00 +0000
1080+++ test/rbkt/ExpQueryResults/zorba/jsoniq/pair_value_boxing_02.xml.res 2012-09-11 15:56:21 +0000
1081@@ -0,0 +1,1 @@
1082+{ "foo" : null }
1083
1084=== modified file 'test/rbkt/Queries/zorba/jsoniq/arr_replace_01.xq'
1085--- test/rbkt/Queries/zorba/jsoniq/arr_replace_01.xq 2012-03-20 15:35:18 +0000
1086+++ test/rbkt/Queries/zorba/jsoniq/arr_replace_01.xq 2012-09-11 15:56:21 +0000
1087@@ -6,7 +6,8 @@
1088 (
1089 replace json value of $o("foo") with $a,
1090 replace json value of $a(3) with 4,
1091- replace json value of $a(1) with $o
1092+ replace json value of $a(1) with $o,
1093+ replace json value of $a(2) with (1, 2)
1094 );
1095
1096 $o, $a
1097
1098=== removed file 'test/rbkt/Queries/zorba/jsoniq/jnty0002-1.spec'
1099--- test/rbkt/Queries/zorba/jsoniq/jnty0002-1.spec 2012-06-19 14:58:25 +0000
1100+++ test/rbkt/Queries/zorba/jsoniq/jnty0002-1.spec 1970-01-01 00:00:00 +0000
1101@@ -1,1 +0,0 @@
1102-Error: http://www.jsoniq.org/errors:JNTY0002
1103
1104=== removed file 'test/rbkt/Queries/zorba/jsoniq/jnty0002-2.spec'
1105--- test/rbkt/Queries/zorba/jsoniq/jnty0002-2.spec 2012-06-19 14:58:25 +0000
1106+++ test/rbkt/Queries/zorba/jsoniq/jnty0002-2.spec 1970-01-01 00:00:00 +0000
1107@@ -1,1 +0,0 @@
1108-Error: http://www.jsoniq.org/errors:JNTY0002
1109
1110=== added file 'test/rbkt/Queries/zorba/jsoniq/obj_insert_06.xq'
1111--- test/rbkt/Queries/zorba/jsoniq/obj_insert_06.xq 1970-01-01 00:00:00 +0000
1112+++ test/rbkt/Queries/zorba/jsoniq/obj_insert_06.xq 2012-09-11 15:56:21 +0000
1113@@ -0,0 +1,5 @@
1114+declare variable $local:foo := {||};
1115+
1116+insert json { "foo" : ("bar1", "bar2"), "blub" : () } into $local:foo;
1117+
1118+$local:foo
1119
1120=== added file 'test/rbkt/Queries/zorba/jsoniq/obj_replace_05.xq'
1121--- test/rbkt/Queries/zorba/jsoniq/obj_replace_05.xq 1970-01-01 00:00:00 +0000
1122+++ test/rbkt/Queries/zorba/jsoniq/obj_replace_05.xq 2012-09-11 15:56:21 +0000
1123@@ -0,0 +1,9 @@
1124+import module namespace j = "http://www.jsoniq.org/functions";
1125+
1126+variable $o := { "foo" : "bar" };
1127+variable $a := [ 1, 2, 3];
1128+
1129+replace json value of $o("foo") with ($a, 10, 100, 1000);
1130+
1131+
1132+$o
1133
1134=== renamed file 'test/rbkt/Queries/zorba/jsoniq/jnty0002-1.xq' => 'test/rbkt/Queries/zorba/jsoniq/pair_value_boxing_01.xq'
1135=== renamed file 'test/rbkt/Queries/zorba/jsoniq/jnty0002-2.xq' => 'test/rbkt/Queries/zorba/jsoniq/pair_value_boxing_02.xq'

Subscribers

People subscribed via source and target branches