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

Proposed by Markos Zaharioudakis
Status: Merged
Approved by: Markos Zaharioudakis
Approved revision: 11614
Merged at revision: 11649
Proposed branch: lp:~zorba-coders/zorba/bug-archiver
Merge into: lp:zorba
Diff against target: 1334 lines (+322/-435)
20 files modified
modules/zorba-query/zorba-query.xq (+0/-9)
modules/zorba-query/zorba-query.xq.src/zorba-query.cpp (+12/-20)
modules/zorba-query/zorba-query.xq.src/zorba-query.h (+58/-33)
src/api/staticcontextimpl.cpp (+109/-6)
src/api/staticcontextimpl.h (+31/-14)
src/compiler/translator/translator.cpp (+4/-0)
src/context/static_context.cpp (+6/-5)
src/functions/external_function.cpp (+1/-1)
src/functions/function.cpp (+22/-0)
src/functions/function.h (+0/-2)
src/runtime/core/fncall_iterator.cpp (+15/-0)
src/runtime/core/fncall_iterator.h (+1/-2)
src/runtime/sctx/sctx_impl.cpp (+23/-8)
src/zorbaserialization/archiver.cpp (+27/-292)
src/zorbaserialization/archiver.h (+0/-30)
src/zorbaserialization/archiver_field.h (+0/-7)
src/zorbaserialization/mem_archiver.h (+1/-1)
test/rbkt/Queries/zorba/file/copy.xqlib (+5/-3)
test/rbkt/Queries/zorba/zorba-query/query-plan2.xq (+4/-1)
test/rbkt/Queries/zorba/zorba-query/uri-mapper.xq (+3/-1)
To merge this branch: bzr merge lp:~zorba-coders/zorba/bug-archiver
Reviewer Review Type Date Requested Status
Markos Zaharioudakis Approve
Review via email: mp+187699@code.launchpad.net

Commit message

1. Fixed plan serializer bug: no more only_for_eval fields
2. invoke() can also be used to invoke function items.

Description of the change

1. Fixed plan serializer bug: no more only_for_eval fields
2. invoke() can also be used to invoke function items.

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

Validation queue starting for the following merge proposals:
https://code.launchpad.net/~zorba-coders/zorba/bug-archiver/+merge/187699

Progress dashboard at http://jenkins.lambda.nu/view/ValidationQueue

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue result for https://code.launchpad.net/~zorba-coders/zorba/bug-archiver/+merge/187699

Stage "TestZorbaUbuntu" failed.
1 tests failed (8560 total tests run).

Check test results at http://jenkins.lambda.nu/job/TestZorbaUbuntu/347/testReport/ to view the results.

lp:~zorba-coders/zorba/bug-archiver updated
11615. By Markos Zaharioudakis

merge from trunk

11616. By Markos Zaharioudakis

fixed failing test

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue starting for the following merge proposals:
https://code.launchpad.net/~zorba-coders/zorba/bug-archiver/+merge/187699

Progress dashboard at http://jenkins.lambda.nu/view/ValidationQueue

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue succeeded - proposal merged!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'modules/zorba-query/zorba-query.xq'
2--- modules/zorba-query/zorba-query.xq 2013-09-26 23:15:11 +0000
3+++ modules/zorba-query/zorba-query.xq 2013-10-03 04:18:30 +0000
4@@ -456,12 +456,3 @@
5 declare function zq:load-from-query-plan($plan as xs:base64Binary,
6 $resolver as item()?, $mapper as item()?) as xs:anyURI external;
7
8-(:~
9- : <p>Internal helper function. Only necessary because of incomplete HOF
10- : support in Zorba.</p>
11- :)
12-declare %private function zq:hof-invoker($hof as item(),
13- $ns as xs:string, $entity as xs:string) as item()*
14-{
15- $hof($ns, $entity)
16-};
17
18=== modified file 'modules/zorba-query/zorba-query.xq.src/zorba-query.cpp'
19--- modules/zorba-query/zorba-query.xq.src/zorba-query.cpp 2013-09-19 20:47:26 +0000
20+++ modules/zorba-query/zorba-query.xq.src/zorba-query.cpp 2013-10-03 04:18:30 +0000
21@@ -22,8 +22,8 @@
22 /*******************************************************************************
23
24 ********************************************************************************/
25-zorba::ExternalFunction*
26-ZorbaQueryModule::getExternalFunction(const zorba::String& localName)
27+zorba::ExternalFunction* ZorbaQueryModule::getExternalFunction(
28+ const zorba::String& localName)
29 {
30 FuncMap_t::iterator lIte = theFunctions.find(localName);
31
32@@ -102,7 +102,7 @@
33
34
35 /*******************************************************************************
36-
37+ Invoked from static_context::~static_context()
38 ********************************************************************************/
39 void ZorbaQueryModule::destroy()
40 {
41@@ -231,7 +231,9 @@
42 /*******************************************************************************
43
44 ********************************************************************************/
45-void ZorbaQueryFunction::throwError(const char *err_localname, const std::string& aErrorMessage)
46+void ZorbaQueryFunction::throwError(
47+ const char *err_localname,
48+ const std::string& aErrorMessage)
49 {
50 String errNS(ZORBA_QUERY_MODULE_NAMESPACE);
51 String errName(err_localname);
52@@ -356,18 +358,12 @@
53
54 //construct the arguments for the url resolver
55 std::vector<ItemSequence_t> lArgs;
56- ItemSequence_t lSeq0 = new SingletonItemSequence(theFunction);
57 ItemSequence_t lSeq1 = new SingletonItemSequence(ZorbaQueryModule::getItemFactory()->createString(aUri));
58 ItemSequence_t lSeq2 = new SingletonItemSequence(ZorbaQueryModule::getItemFactory()->createString(lDataKind));
59- lArgs.push_back(lSeq0);
60 lArgs.push_back(lSeq1);
61 lArgs.push_back(lSeq2);
62
63- //invoke the HOF helper function using the arguments generated
64- Item lHofHelper = ZorbaQueryModule::getItemFactory()->
65- createQName("http://zorba.io/modules/zorba-query", "zq", "hof-invoker");
66-
67- ItemSequence_t lResult = theCtx->invoke(lHofHelper, lArgs);
68+ ItemSequence_t lResult = theCtx->invoke(theFunction, lArgs);
69
70 //Check if the result is an empty sequence by creating an Iterator, this is
71 // cheaper than serializing the result and then checking if it was empty.
72@@ -406,18 +402,12 @@
73
74 //construct the arguments for the url resolver
75 std::vector<ItemSequence_t> lArgs;
76- ItemSequence_t lSeq0 = new SingletonItemSequence(theFunction);
77 ItemSequence_t lSeq1 = new SingletonItemSequence(ZorbaQueryModule::getItemFactory()->createString(aUrl));
78 ItemSequence_t lSeq2 = new SingletonItemSequence(ZorbaQueryModule::getItemFactory()->createString(lDataKind));
79- lArgs.push_back(lSeq0);
80 lArgs.push_back(lSeq1);
81 lArgs.push_back(lSeq2);
82
83- //invoke the HOF helper function using the arguments generated
84- Item lHofHelper = ZorbaQueryModule::getItemFactory()->
85- createQName("http://zorba.io/modules/zorba-query", "zq", "hof-invoker");
86-
87- ItemSequence_t lResult = theCtx->invoke(lHofHelper, lArgs);
88+ ItemSequence_t lResult = theCtx->invoke(theFunction, lArgs);
89
90 // Check if the result is an empty sequence by creating an Iterator, this is
91 // cheaper than serializing the result and then checking if it was empty.
92@@ -460,8 +450,10 @@
93 DynamicContext* lDynCtx = const_cast<DynamicContext*>(aDctx);
94 StaticContext_t lSctxChild = aSctx->createChildContext();
95
96- QueryMap* lQueryMap;
97- if (!(lQueryMap = dynamic_cast<QueryMap*>(lDynCtx->getExternalFunctionParameter("zqQueryMap"))))
98+ QueryMap* lQueryMap =
99+ dynamic_cast<QueryMap*>(lDynCtx->getExternalFunctionParameter("zqQueryMap"));
100+
101+ if (!lQueryMap)
102 {
103 lQueryMap = new QueryMap();
104 lDynCtx->addExternalFunctionParameter("zqQueryMap", lQueryMap);
105
106=== modified file 'modules/zorba-query/zorba-query.xq.src/zorba-query.h'
107--- modules/zorba-query/zorba-query.xq.src/zorba-query.h 2013-08-13 19:19:44 +0000
108+++ modules/zorba-query/zorba-query.xq.src/zorba-query.h 2013-10-03 04:18:30 +0000
109@@ -75,6 +75,10 @@
110 };
111
112
113+
114+/*******************************************************************************
115+
116+********************************************************************************/
117 class ZorbaQueryURIMapper : public URIMapper
118 {
119 protected:
120@@ -97,6 +101,8 @@
121 EntityData const* aEntityData,
122 std::vector<zorba::String>& oUris);
123 };
124+
125+
126 /*******************************************************************************
127 Bag class for objects associated with a prepared query
128 ********************************************************************************/
129@@ -120,7 +126,16 @@
130
131
132 /*******************************************************************************
133+ There is one instance of QueryMap per outer query. The instance is created
134+ on the fly (if it does not exist already) inside the
135+ PrepareMainModuleFunction::evaluate() or LoadFromQueryPlanFunction::evaluate()
136+ methods (when those methods are invoked by the outer query). The instance
137+ is registered in (and owned by) the dctx of the outer query as an
138+ ExternalFunctionParameter with the name "zqQueryMap".
139
140+ For each inner query prepared or loaded by the outer query, the QueryMap
141+ instance maps the symbolic id of the inner query to its associated XQuery
142+ obj and URIMapper and URLResolver objs (if any).
143 ********************************************************************************/
144 class QueryMap : public ExternalFunctionParameter
145 {
146@@ -240,7 +255,11 @@
147 class IsBoundVariableFunction : public ZorbaQueryFunction
148 {
149 public:
150- IsBoundVariableFunction(const ZorbaQueryModule* aModule) : ZorbaQueryFunction(aModule) {}
151+ IsBoundVariableFunction(const ZorbaQueryModule* aModule)
152+ :
153+ ZorbaQueryFunction(aModule)
154+ {
155+ }
156
157 virtual ~IsBoundVariableFunction(){}
158
159@@ -260,7 +279,11 @@
160 class GetExternalVariablesFunction : public ZorbaQueryFunction
161 {
162 public:
163- GetExternalVariablesFunction(const ZorbaQueryModule* aModule) : ZorbaQueryFunction(aModule) {}
164+ GetExternalVariablesFunction(const ZorbaQueryModule* aModule)
165+ :
166+ ZorbaQueryFunction(aModule)
167+ {
168+ }
169
170 virtual ~GetExternalVariablesFunction() {}
171
172@@ -531,39 +554,41 @@
173 const zorba::DynamicContext*) const;
174 };
175
176- class VariableValueFunction : public ZorbaQueryFunction{
177- protected:
178- class ValueItemSequence : public ItemSequence
179- {
180- protected:
181- Iterator_t theIterator;
182-
183- public:
184- ValueItemSequence(Iterator_t& aIter)
185- : theIterator(aIter)
186- {
187- }
188-
189- virtual ~ValueItemSequence(){}
190-
191- Iterator_t
192- getIterator() { return theIterator; }
193-
194- };
195- public:
196- VariableValueFunction(const ZorbaQueryModule* aModule) : ZorbaQueryFunction(aModule) {}
197-
198- virtual ~VariableValueFunction() {}
199-
200- virtual zorba::String
201- getLocalName() const {return "variable-value"; }
202-
203- virtual zorba::ItemSequence_t
204- evaluate(const Arguments_t&,
205- const zorba::StaticContext*,
206- const zorba::DynamicContext*) const;
207+
208+class VariableValueFunction : public ZorbaQueryFunction
209+{
210+protected:
211+ class ValueItemSequence : public ItemSequence
212+ {
213+ protected:
214+ Iterator_t theIterator;
215+
216+ public:
217+ ValueItemSequence(Iterator_t& aIter) : theIterator(aIter)
218+ {
219+ }
220+
221+ virtual ~ValueItemSequence(){}
222+
223+ Iterator_t
224+ getIterator() { return theIterator; }
225+
226 };
227
228+public:
229+ VariableValueFunction(const ZorbaQueryModule* aModule) : ZorbaQueryFunction(aModule) {}
230+
231+ virtual ~VariableValueFunction() {}
232+
233+ virtual zorba::String getLocalName() const {return "variable-value"; }
234+
235+ virtual zorba::ItemSequence_t
236+ evaluate(const Arguments_t&,
237+ const zorba::StaticContext*,
238+ const zorba::DynamicContext*) const;
239+};
240+
241+
242 /*******************************************************************************
243
244 ********************************************************************************/
245
246=== modified file 'src/api/staticcontextimpl.cpp'
247--- src/api/staticcontextimpl.cpp 2013-09-16 09:08:27 +0000
248+++ src/api/staticcontextimpl.cpp 2013-10-03 04:18:30 +0000
249@@ -1527,13 +1527,28 @@
250
251 ********************************************************************************/
252 ItemSequence_t StaticContextImpl::invoke(
253- const Item& aQName,
254+ const Item& aItem,
255+ const std::vector<ItemSequence_t>& aArgs) const
256+{
257+ store::Item_t item = Unmarshaller::getInternalItem(aItem);
258+
259+ if (item->isAtomic())
260+ return invokeFunc(aItem, item, aArgs);
261+ else
262+ return invokeFuncItem(aItem, item, aArgs);
263+}
264+
265+
266+/*******************************************************************************
267+
268+********************************************************************************/
269+ItemSequence_t StaticContextImpl::invokeFunc(
270+ const Item& aItem,
271+ const store::Item_t& qname,
272 const std::vector<ItemSequence_t>& aArgs) const
273 {
274 try
275 {
276- store::Item_t qname = Unmarshaller::getInternalItem(aQName);
277-
278 if (qname->getTypeCode() != store::XS_QNAME)
279 {
280 throw XQUERY_EXCEPTION(err::XPTY0004, ERROR_PARAMS(ZED(BadType_23o), "xs:QName"));
281@@ -1563,7 +1578,7 @@
282 // bind qname and params
283 DynamicContext* queryDctx = query->getDynamicContext();
284
285- queryDctx->setVariable("", "xxx-func-name", aQName);
286+ queryDctx->setVariable("", "xxx-func-name", aItem);
287
288 for (csize i = 0; i < numArgs; ++i)
289 {
290@@ -1598,8 +1613,9 @@
291 // prolog
292 lOut
293 << "import module namespace ref = 'http://www.zorba-xquery.com/modules/reflection';"
294- << std::endl
295- << "declare variable $xxx-func-name as xs:QName" << " external;" << std::endl;
296+ << std::endl;
297+
298+ lOut << "declare variable $xxx-func-name as xs:QName external;" << std::endl;
299
300 for (csize i = 0; i < arity; ++i)
301 {
302@@ -1620,6 +1636,7 @@
303
304 // args
305 lOut << "($xxx-func-name";
306+
307 for (csize i = 0; i < arity; ++i)
308 {
309 lOut << ", $arg" << i;
310@@ -1629,6 +1646,92 @@
311 }
312
313
314+/*******************************************************************************
315+
316+********************************************************************************/
317+ItemSequence_t StaticContextImpl::invokeFuncItem(
318+ const Item& aItem,
319+ const store::Item_t& funcItem,
320+ const std::vector<ItemSequence_t>& aArgs) const
321+{
322+ try
323+ {
324+ if (!funcItem->isFunction())
325+ {
326+ throw XQUERY_EXCEPTION(err::XPTY0004,
327+ ERROR_PARAMS(ZED(BadType_23o), "xs:function()"));
328+ }
329+
330+ csize numArgs = aArgs.size();
331+
332+ String queryStr = createHOFQuery(numArgs);
333+
334+ XQuery_t query(new XQueryImpl());
335+
336+ // compile without any hints
337+ Zorba_CompilerHints_t lHints;
338+ StaticContext_t querySctx = new StaticContextImpl(*this);
339+
340+ query->compile(queryStr, querySctx, lHints);
341+
342+ // bind func item and params
343+ DynamicContext* queryDctx = query->getDynamicContext();
344+
345+ queryDctx->setVariable("", "xxx-func-item", aItem);
346+
347+ for (csize i = 0; i < numArgs; ++i)
348+ {
349+ std::ostringstream argName;
350+ argName << "arg" << i;
351+ queryDctx->setVariable("", argName.str(), aArgs[i]->getIterator());
352+ }
353+
354+ // the XQueryImpl object needs to live as long as its iterator
355+ // because the iterator returned as a result of the query
356+ // contains a reference to the query in order to do cleanup work.
357+ // The same is true for this sctx
358+ return new InvokeItemSequence(query, const_cast<StaticContextImpl*>(this));
359+ }
360+ catch (ZorbaException const& e)
361+ {
362+ ZorbaImpl::notifyError(theDiagnosticHandler, e);
363+ return 0;
364+ }
365+}
366+
367+
368+/*******************************************************************************
369+
370+********************************************************************************/
371+std::string StaticContextImpl::createHOFQuery(csize arity)
372+{
373+ std::ostringstream lOut;
374+
375+ // prolog
376+ lOut << "declare variable $xxx-func-item external;" << std::endl;
377+
378+ for (csize i = 0; i < arity; ++i)
379+ {
380+ lOut << "declare variable $arg" << i << " external;" << std::endl;
381+ }
382+
383+ // body
384+ lOut << "$xxx-func-item(";
385+
386+ for (csize i = 0; i < arity; ++i)
387+ {
388+ lOut << "$arg" << i;
389+
390+ if (i < arity-1)
391+ lOut << ",";
392+ }
393+ lOut << ")";
394+
395+ return lOut.str();
396+}
397+
398+
399+
400 StaticCollectionManager*
401 StaticContextImpl::getStaticCollectionManager() const
402 {
403
404=== modified file 'src/api/staticcontextimpl.h'
405--- src/api/staticcontextimpl.h 2013-09-16 09:08:27 +0000
406+++ src/api/staticcontextimpl.h 2013-10-03 04:18:30 +0000
407@@ -76,9 +76,23 @@
408 protected:
409 static std::string createInvokeQuery(const function*, size_t aArity);
410
411+ static std::string createHOFQuery(size_t aArity);
412+
413 private:
414 StaticContextImpl(const StaticContextImpl&);
415
416+ ItemSequence_t
417+ invokeFunc(
418+ const Item& aItem,
419+ const store::Item_t& qname,
420+ const std::vector<ItemSequence_t>& aArgs) const;
421+
422+ ItemSequence_t
423+ invokeFuncItem(
424+ const Item& aItem,
425+ const store::Item_t& funItem,
426+ const std::vector<ItemSequence_t>& aArgs) const;
427+
428 public:
429 StaticContextImpl(DiagnosticHandler* = 0);
430
431@@ -261,22 +275,25 @@
432 resolve(const String& aRelativeUri, const String& aBaseUri) const;
433
434 virtual bool
435- validate(const Item& rootElement, Item& validatedResult,
436- validation_mode_t validationMode = validate_strict) const;
437-
438- virtual bool
439- validate(const Item& rootElement, Item& validatedResult,
440- const String& targetNamespace,
441- validation_mode_t validationMode = validate_strict) const;
442-
443- virtual bool
444- validateSimpleContent(const String& stringValue,
445- const Item& typeQName,
446- std::vector<Item>& resultList) const;
447+ validate(
448+ const Item& rootElement,
449+ Item& validatedResult,
450+ validation_mode_t validationMode = validate_strict) const;
451+
452+ virtual bool
453+ validate(
454+ const Item& rootElement, Item& validatedResult,
455+ const String& targetNamespace,
456+ validation_mode_t validationMode = validate_strict) const;
457+
458+ virtual bool
459+ validateSimpleContent(
460+ const String& stringValue,
461+ const Item& typeQName,
462+ std::vector<Item>& resultList) const;
463
464 ItemSequence_t
465- invoke(const Item& aQName,
466- const std::vector<ItemSequence_t>& aArgs) const;
467+ invoke(const Item& item, const std::vector<ItemSequence_t>& aArgs) const;
468
469 virtual StaticCollectionManager*
470 getStaticCollectionManager() const;
471
472=== modified file 'src/compiler/translator/translator.cpp'
473--- src/compiler/translator/translator.cpp 2013-09-23 09:11:02 +0000
474+++ src/compiler/translator/translator.cpp 2013-10-03 04:18:30 +0000
475@@ -3458,6 +3458,10 @@
476 if (theSctx->xquery_version() < StaticContextConsts::xquery_version_3_0)
477 bindModuleImportPrefix(targetNS, pfx, loc);
478
479+ // All functions need to be serialized, so we mark the query as having eval
480+ if (targetNS == static_context::ZORBA_SCTX_FN_NS)
481+ theCCB->theHasEval = true;
482+
483 const URILiteralList* atlist = v.get_at_list();
484
485 // If the imported module X is a "pure builtin" one (i.e., contains
486
487=== modified file 'src/context/static_context.cpp'
488--- src/context/static_context.cpp 2013-10-01 22:39:42 +0000
489+++ src/context/static_context.cpp 2013-10-03 04:18:30 +0000
490@@ -37,6 +37,7 @@
491 #include "context/decimal_format.h"
492 #include "context/sctx_map_iterator.h"
493
494+#include "compiler/api/compilercb.h"
495 #include "compiler/expression/expr_base.h"
496 #include "compiler/expression/var_expr.h"
497 #ifndef ZORBA_NO_FULL_TEXT
498@@ -624,7 +625,6 @@
499 ns.compare(0, strlen(ZORBA_IO_NS_PREFIX), ZORBA_IO_NS_PREFIX) == 0)
500 {
501 return (ns == ZORBA_MATH_FN_NS ||
502- ns == ZORBA_SCTX_FN_NS ||
503 ns == ZORBA_JSON_CSV_FN_NS ||
504 ns == ZORBA_JSON_XML_FN_NS ||
505 ns == ZORBA_XQDOC_FN_NS ||
506@@ -1137,10 +1137,11 @@
507 ar & theVariablesMap;
508 ar & theImportedPrivateVariablesMap;
509
510- ar.set_serialize_only_for_eval(true);
511- ar & theFunctionMap;
512- ar & theFunctionArityMap;
513- ar.set_serialize_only_for_eval(false);
514+ if (ar.get_ccb()->theHasEval)
515+ {
516+ ar & theFunctionMap;
517+ ar & theFunctionArityMap;
518+ }
519
520 ar & theCollectionMap;
521
522
523=== modified file 'src/functions/external_function.cpp'
524--- src/functions/external_function.cpp 2013-07-02 21:32:23 +0000
525+++ src/functions/external_function.cpp 2013-10-03 04:18:30 +0000
526@@ -77,7 +77,7 @@
527
528 // if loaded, theImpl needs to be set immediately
529 // this is covered by test/unit/external_function.cpp
530- if(!ar.is_serializing_out())
531+ if (!ar.is_serializing_out())
532 {
533 try
534 {
535
536=== modified file 'src/functions/function.cpp'
537--- src/functions/function.cpp 2013-09-23 09:11:02 +0000
538+++ src/functions/function.cpp 2013-10-03 04:18:30 +0000
539@@ -65,6 +65,18 @@
540 }
541 #endif
542 }
543+#if 0
544+ else
545+ {
546+ std::cout << "Allocated function ";
547+ if (getName())
548+ {
549+ zstring qname = getName()->getStringValue();
550+ std::cout << qname;
551+ }
552+ std::cout << " ( " << this << " )" << std::endl;
553+ }
554+#endif
555
556 setFlag(FunctionConsts::isDeterministic);
557 }
558@@ -76,6 +88,16 @@
559 function::~function()
560 {
561 delete theAnnotationList;
562+
563+#if 0
564+ if (!isBuiltin())
565+ {
566+ std::cout << "Deallocated function ";
567+ if (getName())
568+ std::cout << getName()->getStringValue();
569+ std::cout << " ( " << this << " )" << std::endl;
570+ }
571+#endif
572 }
573
574
575
576=== modified file 'src/functions/function.h'
577--- src/functions/function.h 2013-09-19 16:36:16 +0000
578+++ src/functions/function.h 2013-10-03 04:18:30 +0000
579@@ -98,8 +98,6 @@
580
581 static_context* getStaticContext() const { return theModuleSctx; }
582
583- void setStaticContext(static_context* sctx) { theModuleSctx = sctx; }
584-
585 void setFlag(FunctionConsts::AnnotationFlags flag)
586 {
587 theFlags |= flag;
588
589=== modified file 'src/runtime/core/fncall_iterator.cpp'
590--- src/runtime/core/fncall_iterator.cpp 2013-09-20 20:37:55 +0000
591+++ src/runtime/core/fncall_iterator.cpp 2013-10-03 04:18:30 +0000
592@@ -221,6 +221,21 @@
593
594 ar & theUDF;
595 ar & theIsDynamic;
596+
597+ // If the query does not have eval, theFunctionMap and theFunctionArityMap
598+ // members of static_context are not serialized. This can cause a memory leak
599+ // if theUDF deserialization occuring above allocates a udf obj that is only
600+ // pointed to (via a raw pointer) by this UDFunctionCallIterator. To fix the
601+ // leak, we register the udf in theSctx.
602+ if (!ar.is_serializing_out() &&
603+ !ar.get_ccb()->theHasEval &&
604+ !theUDF->isBuiltin())
605+ {
606+ function* f = theSctx->lookup_fn(theUDF->getName(), theUDF->getArity(), false);
607+
608+ if (!f)
609+ theSctx->bind_fn(theUDF, theUDF->getArity(), loc);
610+ }
611 }
612
613
614
615=== modified file 'src/runtime/core/fncall_iterator.h'
616--- src/runtime/core/fncall_iterator.h 2013-06-15 22:44:20 +0000
617+++ src/runtime/core/fncall_iterator.h 2013-10-03 04:18:30 +0000
618@@ -24,11 +24,10 @@
619
620 #include "runtime/hof/function_item.h"
621 #include "runtime/util/single_item_iterator.h"
622+#include "runtime/base/narybase.h"
623
624 #include "context/static_context.h"
625
626-#include "runtime/base/narybase.h"
627-
628
629 namespace zorba {
630
631
632=== modified file 'src/runtime/sctx/sctx_impl.cpp'
633--- src/runtime/sctx/sctx_impl.cpp 2013-10-01 03:25:43 +0000
634+++ src/runtime/sctx/sctx_impl.cpp 2013-10-03 04:18:30 +0000
635@@ -224,7 +224,9 @@
636 DEFAULT_STACK_INIT( SctxFunctionArgumentsCountIteratorState, state, plan_state );
637
638 consumeNext( lName, theChildren[0].getp(), plan_state );
639+
640 theSctx->find_functions( lName, funcs );
641+
642 FOR_EACH( std::vector<function*>, f, funcs )
643 if ( (*f)->getXQueryVersion() <= theSctx->xquery_version() )
644 state->arities_.push_back( (*f)->getArity() );
645@@ -240,12 +242,14 @@
646
647 ///////////////////////////////////////////////////////////////////////////////
648
649-void SctxFunctionNamesIteratorState::reset( PlanState &plan_state ) {
650+void SctxFunctionNamesIteratorState::reset( PlanState &plan_state )
651+{
652 PlanIteratorState::reset( plan_state );
653 theFunctions.clear();
654 thePosition = 0;
655 }
656
657+
658 bool SctxFunctionNamesIterator::nextImpl( store::Item_t &result,
659 PlanState &plan_state) const {
660 bool already_returned;
661@@ -254,8 +258,11 @@
662 DEFAULT_STACK_INIT( SctxFunctionNamesIteratorState, state, plan_state );
663
664 theSctx->get_functions( state->theFunctions );
665+
666 state->thePosition = 0;
667- while ( state->thePosition < state->theFunctions.size() ) {
668+
669+ while ( state->thePosition < state->theFunctions.size() )
670+ {
671 result = state->theFunctions[state->thePosition]->getName();
672 already_returned = false;
673
674@@ -285,13 +292,17 @@
675
676 ///////////////////////////////////////////////////////////////////////////////
677
678-void SctxFunctionsIteratorState::reset( PlanState &plan_state ) {
679+void SctxFunctionsIteratorState::reset( PlanState &plan_state )
680+{
681 PlanIteratorState::reset( plan_state );
682 funcs_.clear();
683 }
684
685-bool SctxFunctionsIterator::nextImpl( store::Item_t &result,
686- PlanState &plan_state) const {
687+
688+bool SctxFunctionsIterator::nextImpl(
689+ store::Item_t &result,
690+ PlanState &plan_state) const
691+{
692 AnnotationList const *annotations;
693 function const *func;
694 store::Item_t item;
695@@ -302,8 +313,10 @@
696 DEFAULT_STACK_INIT( SctxFunctionsIteratorState, state, plan_state );
697
698 theSctx->get_functions( state->funcs_ );
699+
700 for ( state->it_ = state->funcs_.begin(); state->it_ != state->funcs_.end();
701- ++state->it_ ) {
702+ ++state->it_ )
703+ {
704 func = *state->it_;
705 if ( func->getXQueryVersion() > theSctx->xquery_version() )
706 continue;
707@@ -319,14 +332,16 @@
708 GENV_ITEMFACTORY->createInt( item, func->getArity() );
709 values.push_back( item );
710
711- if ( (annotations = func->getAnnotationList()) ) {
712+ if ( (annotations = func->getAnnotationList()) )
713+ {
714 s = "annotations";
715 GENV_ITEMFACTORY->createString( item, s );
716 keys.push_back( item );
717
718 vector<store::Item_t> elements;
719 AnnotationList::size_type const size = annotations->size();
720- for ( AnnotationList::size_type i = 0; i < size; ++i ) {
721+ for ( AnnotationList::size_type i = 0; i < size; ++i )
722+ {
723 item = annotations->get( i )->getQName();
724 elements.push_back( item );
725 }
726
727=== modified file 'src/zorbaserialization/archiver.cpp'
728--- src/zorbaserialization/archiver.cpp 2013-02-28 17:33:05 +0000
729+++ src/zorbaserialization/archiver.cpp 2013-10-03 04:18:30 +0000
730@@ -47,7 +47,6 @@
731 TypeCode type,
732 const void* ptr,
733 ArchiveFieldKind kind,
734- int only_for_eval,
735 ENUM_ALLOW_DELAY allow_delay,
736 unsigned int level)
737 :
738@@ -64,7 +63,6 @@
739 theFirstChild(NULL),
740 theLastChild(NULL),
741 theParent(NULL),
742- theOnlyForEval(only_for_eval),
743 theAllowDelay2(allow_delay)
744 {
745 assert(theKind == ARCHIVE_FIELD_NORMAL ||
746@@ -163,7 +161,6 @@
747 const void* ptr,
748 ArchiveFieldKind kind,
749 archive_field* refered,
750- int only_for_eval,
751 ENUM_ALLOW_DELAY allow_delay,
752 unsigned int level)
753 :
754@@ -180,7 +177,6 @@
755 theFirstChild(NULL),
756 theLastChild(NULL),
757 theParent(NULL),
758- theOnlyForEval(only_for_eval),
759 theAllowDelay2(allow_delay)
760 {
761 assert(type != TYPE_ENUM);
762@@ -228,7 +224,6 @@
763 theCurrentLevel(0),
764 theNonClassFieldsMap(0),
765 theClassFieldsMap(0),
766- theOnlyForEval(0),
767 all_reference_list(0),
768 internal_archive(internal_archive),
769 theSerializeEverything(false),
770@@ -246,7 +241,6 @@
771 NULL, // ptr
772 ARCHIVE_FIELD_NORMAL,
773 NULL, // referred
774- false, // only for eval
775 ALLOW_DELAY,
776 0); // level
777
778@@ -344,7 +338,6 @@
779 new_field = new archive_field(type,
780 ptr,
781 ARCHIVE_FIELD_NORMAL,
782- get_serialize_only_for_eval(),
783 theAllowDelay2,
784 theCurrentLevel);
785
786@@ -400,7 +393,6 @@
787 NULL, // ptr
788 ARCHIVE_FIELD_REFERENCING,
789 ref_field,
790- get_serialize_only_for_eval(),
791 theAllowDelay2,
792 theCurrentLevel);
793 }
794@@ -409,7 +401,6 @@
795 new_field = new archive_field(type,
796 ptr,
797 ARCHIVE_FIELD_PTR,
798- get_serialize_only_for_eval(),
799 theAllowDelay2,
800 theCurrentLevel);
801 }
802@@ -421,7 +412,6 @@
803 NULL, // ptr
804 ARCHIVE_FIELD_NULL,
805 NULL,
806- get_serialize_only_for_eval(),
807 theAllowDelay2,
808 theCurrentLevel);
809 }
810@@ -511,7 +501,6 @@
811 ptr,
812 field_kind,
813 ref_field,
814- get_serialize_only_for_eval(),
815 theAllowDelay2,
816 theCurrentLevel);
817
818@@ -656,39 +645,10 @@
819
820
821 /*******************************************************************************
822- Return the left sibling of a given field (NULL if there is no left sibling).
823-********************************************************************************/
824-archive_field* Archiver::get_prev(archive_field* field)
825-{
826- archive_field* temp;
827- temp = field->theParent->theFirstChild;
828-
829- if (temp == field)
830- return NULL;
831-
832- while (temp)
833- {
834- if (temp->theNextSibling == field)
835- return temp;
836-
837- temp = temp->theNextSibling;
838- }
839-
840- assert(false);
841- return NULL;
842-}
843-
844-
845-/*******************************************************************************
846
847 ********************************************************************************/
848 void Archiver::prepare_serialize_out()
849 {
850- if (!is_serialize_everything())
851- {
852- check_compound_fields(theRootField);
853- }
854-
855 while(check_allowed_delays(theRootField))
856 {
857 }
858@@ -698,255 +658,6 @@
859 /*******************************************************************************
860
861 ********************************************************************************/
862-void Archiver::check_compound_fields(archive_field* parent_field)
863-{
864- //resolve all references first
865- //iterate: find the reference to the top most eval_only field and resolve it
866- archive_field* refering_field;
867-
868- while (1)
869- {
870- refering_field = find_top_most_eval_only_field(parent_field);
871-
872- if(!refering_field)
873- break;
874-
875- if((refering_field->theReferredField->theAllowDelay2 != ALLOW_DELAY) ||
876- (refering_field->theReferredField->theKind == ARCHIVE_FIELD_NORMAL) ||
877- !refering_field->theReferredField->theOnlyForEval)
878- {
879- //must preserve this serialization
880- archive_field* temp_field = refering_field->theReferredField->theParent;
881- while(temp_field)
882- {
883- temp_field->theOnlyForEval = 0;
884- temp_field = temp_field->theParent;
885- }
886- }
887- else
888- {
889- exchange_mature_fields(refering_field, refering_field->theReferredField);
890- refering_field->theOnlyForEval = refering_field->theReferredField->theOnlyForEval;
891- }
892-
893- clean_only_for_eval(refering_field->theReferredField,
894- get_only_for_eval(refering_field->theReferredField));
895- }
896-
897- while (check_only_for_eval_nondelay_referencing(parent_field))
898- {
899- }
900-
901- replace_only_for_eval_with_null(parent_field);
902-}
903-
904-
905-/*******************************************************************************
906-
907-********************************************************************************/
908-archive_field* Archiver::find_top_most_eval_only_field(archive_field* parent_field)
909-{
910- int ref_depth = -1;
911- archive_field* refering_field = NULL;
912-
913- archive_field* child = parent_field->theFirstChild;
914-
915- while (child)
916- {
917- if (child->theOnlyForEval)
918- {
919- }
920- else if (child->theKind == ARCHIVE_FIELD_REFERENCING &&
921- get_only_for_eval(child->theReferredField))
922- {
923- int new_depth = compute_field_depth(child->theReferredField);
924- if(!refering_field || (ref_depth > new_depth))
925- {
926- ref_depth = new_depth;
927- refering_field = child;
928- }
929- }
930- else if (!child->theIsSimple && !child->theReferredField)
931- {
932- archive_field* new_refering = find_top_most_eval_only_field(child);
933-
934- if (new_refering)
935- {
936- int new_depth = compute_field_depth(new_refering->theReferredField);
937- if (!refering_field || (ref_depth > new_depth))
938- {
939- ref_depth = new_depth;
940- refering_field = new_refering;
941- }
942- }
943- }
944-
945- child = child->theNextSibling;
946- }
947-
948- return refering_field;
949-}
950-
951-
952-/*******************************************************************************
953-
954-********************************************************************************/
955-int Archiver::compute_field_depth(archive_field* field)
956-{
957- archive_field* temp;
958- int i = 0;
959- temp = field->theParent;
960- while(temp)
961- {
962- temp = temp->theParent;
963- i++;
964- }
965- return i;
966-}
967-
968-
969-/*******************************************************************************
970-
971-********************************************************************************/
972-int Archiver::get_only_for_eval(archive_field* field)
973-{
974- if (field->theOnlyForEval)
975- return field->theOnlyForEval;
976-
977- archive_field* child;
978- for (child = field->theFirstChild; child; child = child->theNextSibling)
979- {
980- if (child->theOnlyForEval)
981- return child->theOnlyForEval;
982- }
983-
984- return 0;
985-}
986-
987-
988-/*******************************************************************************
989-
990-********************************************************************************/
991-void Archiver::clean_only_for_eval(archive_field* field, int substract_value)
992-{
993- if (field->theOnlyForEval >= substract_value)
994- field->theOnlyForEval -= substract_value;
995- else
996- field->theOnlyForEval = 0;
997-
998- if (!field->theIsSimple)
999- {
1000- archive_field* child = field->theFirstChild;
1001- while (child)
1002- {
1003- clean_only_for_eval(child, substract_value);
1004- child = child->theNextSibling;
1005- }
1006- }
1007-}
1008-
1009-
1010-/*******************************************************************************
1011-
1012-********************************************************************************/
1013-bool Archiver::check_only_for_eval_nondelay_referencing(archive_field* parent_field)
1014-{
1015- archive_field* current_field = parent_field->theFirstChild;
1016-
1017- while (current_field)
1018- {
1019- if (current_field->theOnlyForEval && current_field->theKind != ARCHIVE_FIELD_NORMAL)
1020- {
1021- if (current_field->theKind == ARCHIVE_FIELD_REFERENCING &&
1022- current_field->theAllowDelay2 != ALLOW_DELAY &&
1023- !current_field->theReferredField->theOnlyForEval)
1024- {
1025- //must preserve this serialization
1026- archive_field* temp_field = current_field->theParent;
1027- while (temp_field)
1028- {
1029- temp_field->theOnlyForEval = 0;
1030- temp_field = temp_field->theParent;
1031- }
1032- clean_only_for_eval(current_field, current_field->theOnlyForEval);
1033- return true;
1034- }
1035- }
1036-
1037- if (!current_field->theIsSimple)
1038- {
1039- if (check_only_for_eval_nondelay_referencing(current_field))
1040- return true;
1041- }
1042-
1043- current_field = current_field->theNextSibling;
1044- }
1045- return false;
1046-}
1047-
1048-
1049-/*******************************************************************************
1050-
1051-********************************************************************************/
1052-void Archiver::replace_only_for_eval_with_null(archive_field* parent_field)
1053-{
1054- archive_field* current_field = parent_field->theFirstChild;
1055-
1056- while (current_field)
1057- {
1058- if (current_field->theOnlyForEval &&
1059- (current_field->theKind != ARCHIVE_FIELD_NORMAL) &&
1060- (current_field->theKind != ARCHIVE_FIELD_BASECLASS))
1061- {
1062- //don't save it, replace it with NULL if possible
1063- archive_field* null_field = replace_with_null(current_field);
1064-
1065- orphan_fields.push_back(current_field);
1066- current_field = null_field;
1067- }
1068-
1069- if (!current_field->theIsSimple)
1070- {
1071- replace_only_for_eval_with_null(current_field);
1072- }
1073-
1074- current_field = current_field->theNextSibling;
1075- }
1076-}
1077-
1078-
1079-/*******************************************************************************
1080-
1081-********************************************************************************/
1082-archive_field* Archiver::replace_with_null(archive_field* current_field)
1083-{
1084- if (current_field->theParent)
1085- {
1086- archive_field* null_field = new archive_field(TYPE_NULL,
1087- current_field->theIsSimple,
1088- current_field->theIsClass,
1089- NULL,
1090- ARCHIVE_FIELD_NULL,
1091- NULL,
1092- false,
1093- ALLOW_DELAY,
1094- current_field->theLevel);
1095- null_field->theId = 0;
1096- replace_field(null_field, current_field);
1097- current_field->theParent = NULL;
1098- current_field->theNextSibling = NULL;
1099-
1100- return null_field;
1101- }
1102-
1103- //otherwise it is orphan
1104- return NULL;
1105-}
1106-
1107-
1108-/*******************************************************************************
1109-
1110-********************************************************************************/
1111 bool Archiver::check_allowed_delays(archive_field* parent_field)
1112 {
1113 //check all fields with dont_allow_delay and see if they are delayed
1114@@ -962,9 +673,9 @@
1115 }
1116
1117 if (child->theKind == ARCHIVE_FIELD_REFERENCING &&
1118- ((child->theAllowDelay2 == DONT_ALLOW_DELAY &&
1119- check_order(child, child->theReferredField) < 1) ||
1120- child->theAllowDelay2 == SERIALIZE_NOW))
1121+ ((child->theAllowDelay2 == DONT_ALLOW_DELAY &&
1122+ check_order(child, child->theReferredField) < 1) ||
1123+ child->theAllowDelay2 == SERIALIZE_NOW))
1124 {
1125 if (child->theReferredField->theKind == ARCHIVE_FIELD_NORMAL ||
1126 child->theReferredField->theAllowDelay2 == SERIALIZE_NOW)
1127@@ -1058,6 +769,30 @@
1128 }
1129
1130
1131+/*******************************************************************************
1132+ Return the left sibling of a given field (NULL if there is no left sibling).
1133+********************************************************************************/
1134+archive_field* Archiver::get_prev(archive_field* field)
1135+{
1136+ archive_field* temp;
1137+ temp = field->theParent->theFirstChild;
1138+
1139+ if (temp == field)
1140+ return NULL;
1141+
1142+ while (temp)
1143+ {
1144+ if (temp->theNextSibling == field)
1145+ return temp;
1146+
1147+ temp = temp->theNextSibling;
1148+ }
1149+
1150+ assert(false);
1151+ return NULL;
1152+}
1153+
1154+
1155 ////////////////////////////////////////////////////////////////////////////////
1156 // //
1157 // De-Serialization only //
1158
1159=== modified file 'src/zorbaserialization/archiver.h'
1160--- src/zorbaserialization/archiver.h 2013-02-07 17:24:36 +0000
1161+++ src/zorbaserialization/archiver.h 2013-10-03 04:18:30 +0000
1162@@ -172,8 +172,6 @@
1163
1164 FieldMap * theClassFieldsMap;
1165
1166- int theOnlyForEval;
1167-
1168
1169 void ** all_reference_list;
1170
1171@@ -322,24 +320,8 @@
1172
1173 void replace_field(archive_field* new_field, archive_field* ref_field);
1174
1175- archive_field* replace_with_null(archive_field* current_field);
1176-
1177 void register_pointers_internal(archive_field* fields);
1178
1179- int compute_field_depth(archive_field* field);
1180-
1181- int get_only_for_eval(archive_field* field);
1182-
1183- archive_field* find_top_most_eval_only_field(archive_field* parent_field);
1184-
1185- bool check_only_for_eval_nondelay_referencing(archive_field* parent_field);
1186-
1187- void replace_only_for_eval_with_null(archive_field* parent_field);
1188-
1189- void clean_only_for_eval(archive_field* field, int substract_value);
1190-
1191- void check_compound_fields(archive_field* parent_field);
1192-
1193 bool check_allowed_delays(archive_field* parent_field);
1194
1195 int check_order(archive_field* field1, archive_field* field2);
1196@@ -370,18 +352,6 @@
1197 public:
1198 void register_item(store::Item* i);
1199
1200- int get_serialize_only_for_eval() { return theOnlyForEval; }
1201-
1202- void set_serialize_only_for_eval(bool evalonly)
1203- {
1204- if (evalonly)
1205- theOnlyForEval++;
1206- else
1207- theOnlyForEval--;
1208-
1209- assert(theOnlyForEval >= 0);
1210- }
1211-
1212 void dont_allow_delay(ENUM_ALLOW_DELAY d = DONT_ALLOW_DELAY)
1213 {
1214 theAllowDelay2 = d;
1215
1216=== modified file 'src/zorbaserialization/archiver_field.h'
1217--- src/zorbaserialization/archiver_field.h 2012-05-25 13:57:00 +0000
1218+++ src/zorbaserialization/archiver_field.h 2013-10-03 04:18:30 +0000
1219@@ -125,9 +125,6 @@
1220 ----------
1221 The parent field in the fields tree.
1222
1223- theOnlyForEval:
1224- ---------------
1225-
1226 theAllowDelay2:
1227 ---------------
1228
1229@@ -174,8 +171,6 @@
1230 class archive_field * theLastChild;
1231 class archive_field * theParent;
1232
1233- int theOnlyForEval;
1234-
1235 ENUM_ALLOW_DELAY theAllowDelay2;
1236
1237 #ifdef ZORBA_PLAN_SERIALIZER_STATISTICS
1238@@ -191,7 +186,6 @@
1239 const void* ptr,
1240 ArchiveFieldKind kind,
1241 archive_field* refered,
1242- int only_for_eval,
1243 ENUM_ALLOW_DELAY allow_delay,
1244 unsigned int level);
1245
1246@@ -199,7 +193,6 @@
1247 TypeCode type,
1248 const void* ptr,
1249 ArchiveFieldKind kind,
1250- int only_for_eval,
1251 ENUM_ALLOW_DELAY allow_delay,
1252 unsigned int level);
1253
1254
1255=== modified file 'src/zorbaserialization/mem_archiver.h'
1256--- src/zorbaserialization/mem_archiver.h 2013-02-07 17:24:36 +0000
1257+++ src/zorbaserialization/mem_archiver.h 2013-10-03 04:18:30 +0000
1258@@ -39,7 +39,7 @@
1259 :
1260 Archiver(is_serializing_out, internal_archive),
1261 temp_field(TYPE_LAST, false, false, NULL,
1262- ARCHIVE_FIELD_NORMAL, NULL, false, ALLOW_DELAY, 0)
1263+ ARCHIVE_FIELD_NORMAL, NULL, ALLOW_DELAY, 0)
1264 {
1265 current_field = NULL;
1266 is_after_last = false;
1267
1268=== modified file 'test/rbkt/Queries/zorba/file/copy.xqlib'
1269--- test/rbkt/Queries/zorba/file/copy.xqlib 2013-08-09 08:27:30 +0000
1270+++ test/rbkt/Queries/zorba/file/copy.xqlib 2013-10-03 04:18:30 +0000
1271@@ -4,8 +4,9 @@
1272
1273 declare namespace ann = "http://zorba.io/annotations";
1274
1275-declare %ann:nondeterministic %ann:sequential function fct:test-copy($rbktPath as xs:string, $file as xs:string) {
1276-
1277+declare %ann:nondeterministic %ann:sequential
1278+function fct:test-copy($rbktPath as xs:string, $file as xs:string)
1279+{
1280 variable $fileSrc := fn:concat($rbktPath, "/Queries/zorba/file/copy_files/", $file);
1281 variable $fileDest := fn:concat($rbktPath, "/Queries/zorba/file/copy_files/", $file, ".out");
1282
1283@@ -21,7 +22,8 @@
1284 (: read both files back and compare :)
1285 let $src := file:read-binary($fileSrc)
1286 let $dest := file:read-binary($fileDest)
1287- return {
1288+ return
1289+ {
1290 variable $result := $src eq $dest;
1291
1292 (: delete the file before we terminate :)
1293
1294=== modified file 'test/rbkt/Queries/zorba/zorba-query/query-plan2.xq'
1295--- test/rbkt/Queries/zorba/zorba-query/query-plan2.xq 2013-08-13 19:19:44 +0000
1296+++ test/rbkt/Queries/zorba/zorba-query/query-plan2.xq 2013-10-03 04:18:30 +0000
1297@@ -4,7 +4,8 @@
1298 declare namespace op = "http://zorba.io/options/features";
1299 declare namespace f = "http://zorba.io/features";
1300
1301-declare function resolver:url-resolver($namespace as xs:string, $entity as xs:string) {
1302+declare function resolver:url-resolver($namespace as xs:string, $entity as xs:string)
1303+{
1304 if($namespace = 'http://test')
1305 then "module namespace test = 'http://test'; declare function test:foo(){'foo'};"
1306 else ()
1307@@ -16,5 +17,7 @@
1308
1309
1310 variable $query-plan := zq:query-plan($queryID);
1311+
1312 variable $queryID2 := zq:load-from-query-plan($query-plan, resolver:url-resolver#2, ());
1313+
1314 zq:evaluate ($queryID2)
1315
1316=== modified file 'test/rbkt/Queries/zorba/zorba-query/uri-mapper.xq'
1317--- test/rbkt/Queries/zorba/zorba-query/uri-mapper.xq 2013-08-13 19:19:44 +0000
1318+++ test/rbkt/Queries/zorba/zorba-query/uri-mapper.xq 2013-10-03 04:18:30 +0000
1319@@ -5,7 +5,8 @@
1320 declare namespace op = "http://zorba.io/options/features";
1321 declare namespace f = "http://zorba.io/features";
1322
1323-declare function resolver:url-resolver($namespace as xs:string, $entity as xs:string) {
1324+declare function resolver:url-resolver($namespace as xs:string, $entity as xs:string)
1325+{
1326 if($namespace = 'http://foo')
1327 then "module namespace test = 'http://test'; declare function test:foo(){'foo'};"
1328 else ()
1329@@ -23,4 +24,5 @@
1330 "import module namespace test = 'http://test'; test:foo()",
1331 resolver:url-resolver#2, mapper:uri-mapper#2
1332 );
1333+
1334 zq:evaluate($queryID)

Subscribers

People subscribed via source and target branches