Markos Zaharioudakis has proposed merging lp:~zorba-coders/zorba/bug-archiver
into lp:zorba.
Commit message:
1. Fixed plan serializer bug: no more only_for_eval fields
2. invoke() can also be used to invoke function items.
Requested reviews:
Markos Zaharioudakis (markos-za)
For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug-archiver/+merge/187699
1. Fixed plan serializer bug: no more only_for_eval fields
2. invoke() can also be used to invoke function items.
--
https://code.launchpad.net/~zorba-coders/zorba/bug-archiver/+merge/187699
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'modules/zorba-query/zorba-query.xq'
--- modules/zorba-query/zorba-query.xq 2013-08-14 06:22:00 +
+++ modules/zorba-query/zorba-query.xq 2013-09-26 09:43:49 +
@@ -456,12 +456,3 @@
declare function zq:load-from-query-plan($plan as xs:base64Binary,
$resolver as item()?, $mapper as item()?) as xs:anyURI external;
-(:~
- : pInternal helper function. Only necessary because of incomplete HOF
- : support in Zorba./p
- :)
-declare %private function zq:hof-invoker($hof as item(),
- $ns as xs:string, $entity as xs:string) as item()*
-{
- $hof($ns, $entity)
-};
=== modified file 'modules/zorba-query/zorba-query.xq.src/zorba-query.cpp'
--- modules/zorba-query/zorba-query.xq.src/zorba-query.cpp 2013-09-19 20:47:26 +
+++ modules/zorba-query/zorba-query.xq.src/zorba-query.cpp 2013-09-26 09:43:49 +
@@ -22,8 +22,8 @@
/***
/
-zorba::ExternalFunction*
-ZorbaQueryModule::getExternalFunction(const zorba::String localName)
+zorba::ExternalFunction* ZorbaQueryModule::getExternalFunction(
+const zorba::String localName)
{
FuncMap_t::iterator lIte = theFunctions.find(localName);
@@ -102,7 +102,7 @@
/***
-
+ Invoked from static_context::~static_context()
/
void ZorbaQueryModule::destroy()
{
@@ -231,7 +231,9 @@
/***
/
-void ZorbaQueryFunction::throwError(const char *err_localname, const std::string aErrorMessage)
+void ZorbaQueryFunction::throwError(
+const char *err_localname,
+const std::string aErrorMessage)
{
String errNS(ZORBA_QUERY_MODULE_NAMESPACE);
String errName(err_localname);
@@ -356,18 +358,12 @@
//construct the arguments for the url resolver
std::vectorItemSequence_t lArgs;
- ItemSequence_t lSeq0 = new SingletonItemSequence(theFunction);
ItemSequence_t lSeq1 = new SingletonItemSequence(ZorbaQueryModule::getItemFactory()-createString(aUri));
ItemSequence_t lSeq2 = new SingletonItemSequence(ZorbaQueryModule::getItemFactory()-createString(lDataKind));
- lArgs.push_back(lSeq0);
lArgs.push_back(lSeq1);
lArgs.push_back(lSeq2);
- //invoke the HOF helper function using the arguments generated
- Item lHofHelper = ZorbaQueryModule::getItemFactory()-
- createQName(http://zorba.io/modules/zorba-query;, zq, hof-invoker);
-
- ItemSequence_t lResult = theCtx-invoke(lHofHelper, lArgs);
+ ItemSequence_t lResult = theCtx-invoke(theFunction, lArgs);
//Check if the result is an empty sequence by creating an Iterator, this is
// cheaper than serializing the result and then checking if it was empty.
@@ -406,18 +402,12 @@
//construct the arguments for the url resolver
std::vectorItemSequence_t lArgs;
- ItemSequence_t lSeq0 = new SingletonItemSequence(theFunction);
ItemSequence_t lSeq1 = new SingletonItemSequence(ZorbaQueryModule::getItemFactory()-createString(aUrl));
ItemSequence_t lSeq2 = new SingletonItemSequence(ZorbaQueryModule::getItemFactory()-createString(lDataKind));
- lArgs.push_back(lSeq0);
lArgs.push_back(lSeq1);
lArgs.push_back(lSeq2);
- //invoke the HOF helper function using the arguments generated
- Item lHofHelper = ZorbaQueryModule::getItemFactory()-
- createQName(http://zorba.io/modules/zorba-query;, zq, hof-invoker);
-
- ItemSequence_t lResult = theCtx-invoke(lHofHelper, lArgs);
+ ItemSequence_t lResult = theCtx-invoke(theFunction, lArgs);
// Check if the result is an empty sequence by creating an Iterator, this is
// cheaper than serializing the result and then checking if it was empty.
@@ -460,8 +450,10 @@
DynamicContext* lDynCtx = const_castDynamicContext*(aDctx);
StaticContext_t lSctxChild = aSctx-createChildContext();
- QueryMap* lQueryMap;
- if (!(lQueryMap = dynamic_castQueryMap*(lDynCtx-getExternalFunctionParameter(zqQueryMap
+ QueryMap* lQueryMap =
+ dynamic_castQueryMap*(lDynCtx-getExternalFunctionParameter(zqQueryMap));
+
+ if (!lQueryMap)
{