← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/bug1133806_xqxq_base_uri into lp:zorba

 

Chris Hillery has proposed merging lp:~zorba-coders/zorba/bug1133806_xqxq_base_uri into lp:zorba.

Requested reviews:
  Zorba Coders (zorba-coders)
Related bugs:
  Bug #1133806 in Zorba: "XQXQ should set base URI of execution context"
  https://bugs.launchpad.net/zorba/+bug/1133806

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug1133806_xqxq_base_uri/+merge/168020

Just want to see the diff here.
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug1133806_xqxq_base_uri/+merge/168020
Your team Zorba Coders is requested to review the proposed merge of lp:~zorba-coders/zorba/bug1133806_xqxq_base_uri into lp:zorba.
=== modified file 'modules/xqxq/xqxq.xq.src/xqxq.cpp'
--- modules/xqxq/xqxq.xq.src/xqxq.cpp	2013-05-28 00:58:27 +0000
+++ modules/xqxq/xqxq.xq.src/xqxq.cpp	2013-06-07 11:18:32 +0000
@@ -469,8 +469,9 @@
   String lQueryString = getOneStringArgument(aArgs, 0); 
     
   XQuery_t lQuery;
-    
+
   StaticContext_t ltempSctx = lZorba->createStaticContext();
+  ltempSctx->setBaseURI(aSctx->getBaseURI());
 
   std::auto_ptr<XQXQURLResolver> lResolver;
   std::auto_ptr<XQXQURIMapper> lMapper;
@@ -938,7 +939,7 @@
 
   zorba::DynamicContext* lCtx = lQuery->getDynamicContext();
   zorba::String lNS = lVarQName.getNamespace(), lLocal = lVarQName.getLocalName();
-
+  
   try
   {
     lIsBoundVariable = lCtx->isBoundExternalVariable(lNS, lLocal);

=== modified file 'src/runtime/core/fncall_iterator.cpp'
--- src/runtime/core/fncall_iterator.cpp	2013-04-24 01:35:58 +0000
+++ src/runtime/core/fncall_iterator.cpp	2013-06-07 11:18:32 +0000
@@ -804,7 +804,6 @@
 
       // The planState.theQuery maybe null, e.g. in the case of constant-folding
       // of global variable expressions
-
       StaticContextImpl theSctxWrapper(theModuleSctx,
                                        (planState.theQuery == NULL?
                                         NULL :
@@ -814,9 +813,13 @@
                                         planState.theGlobalDynCtx,
                                         theModuleSctx);
 
+      if (lNonePureFct->getURI() == "http://www.zorba-xquery.com/modules/xqxq";)
+        theSctxWrapper.setBaseURI(theSctx->get_base_uri().c_str());
+
       state->theResult = lNonePureFct->evaluate(state->m_extArgs,
                                                 &theSctxWrapper,
                                                 &theDctxWrapper);
+      
       if(state->theResult.get() != NULL)
         state->theResultIter = state->theResult->getIterator();
     } // if (!theFunction->isContextual())


Follow ups