zorba-coders team mailing list archive
-
zorba-coders team
-
Mailing list archive
-
Message #25193
[Merge] lp:~zorba-coders/zorba/feature-no-mat-setVariable into lp:zorba
Matthias Brantner has proposed merging lp:~zorba-coders/zorba/feature-no-mat-setVariable into lp:zorba.
Commit message:
non-materializing query chaining using DynamicContext::setVariable
Requested reviews:
Matthias Brantner (matthias-brantner)
For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/feature-no-mat-setVariable/+merge/179831
non-materializing query chaining using DynamicContext::setVariable
--
https://code.launchpad.net/~zorba-coders/zorba/feature-no-mat-setVariable/+merge/179831
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'include/zorba/dynamic_context.h'
--- include/zorba/dynamic_context.h 2013-08-01 07:58:48 +0000
+++ include/zorba/dynamic_context.h 2013-08-13 00:13:40 +0000
@@ -102,13 +102,16 @@
* @param aQName the QName that identifies the external variable.
* @param aIterator the Iterator producing the sequence that is assigned
* to the variable.
+ * @param aMaterialize determines whether the result of the iterator should
+ * be materialized before binding it to the variable.
* @return true if the variable has been set successfully, false otherwise.
* @throw ZorbaException if an error occured (e.g. the given Iterator is not valid).
*/
virtual bool
setVariable(
const String& aQName,
- const Iterator_t& aIterator) = 0;
+ const Iterator_t& aIterator,
+ bool aMaterialize = true) = 0;
/**
* \brief Defines the external variable identified by an expanded QName and
@@ -121,6 +124,8 @@
* @param aLocalname the local name of the variable's expanded QName
* @param aIterator the Iterator producing the sequence that is assigned
* to the variable.
+ * @param aMaterialize determines whether the result of the iterator should
+ * be materialized before binding it to the variable.
* @return true if the variable has been set successfully, false otherwise.
* @throw ZorbaException if an error occured (e.g. the given Iterator is not valid).
*/
@@ -128,7 +133,8 @@
setVariable(
const String& aNamespace,
const String& aLocalname,
- const Iterator_t& aIterator) = 0;
+ const Iterator_t& aIterator,
+ bool aMaterialize = true) = 0;
/** \brief Returns the current value of an external
* variable. Exactly one of the two return values (aItem or
=== modified file 'src/api/dynamiccontextimpl.cpp'
--- src/api/dynamiccontextimpl.cpp 2013-08-01 17:23:58 +0000
+++ src/api/dynamiccontextimpl.cpp 2013-08-13 00:13:40 +0000
@@ -232,7 +232,8 @@
********************************************************************************/
bool DynamicContextImpl::setVariable(
const String& inVarName,
- const Iterator_t& inValue)
+ const Iterator_t& inValue,
+ bool aMaterialize)
{
ZORBA_DCTX_TRY
{
@@ -267,7 +268,7 @@
ulong varId = var->getId();
- theCtx->add_variable(varId, value);
+ theCtx->add_variable(varId, value, aMaterialize);
return true;
}
@@ -282,7 +283,8 @@
bool DynamicContextImpl::setVariable(
const String& inNamespace,
const String& inLocalname,
- const Iterator_t& inValue)
+ const Iterator_t& inValue,
+ bool aMaterialize)
{
ZORBA_DCTX_TRY
{
@@ -319,7 +321,7 @@
ulong varId = var->getId();
- theCtx->add_variable(varId, value);
+ theCtx->add_variable(varId, value, aMaterialize);
return true;
}
=== modified file 'src/api/dynamiccontextimpl.h'
--- src/api/dynamiccontextimpl.h 2013-08-01 07:57:57 +0000
+++ src/api/dynamiccontextimpl.h 2013-08-13 00:13:40 +0000
@@ -107,13 +107,15 @@
virtual bool
setVariable(
const String& inVarName,
- const Iterator_t& inValue);
+ const Iterator_t& inValue,
+ bool aMaterialize = true);
virtual bool
setVariable(
const String& inNamespace,
const String& inLocalname,
- const Iterator_t& inValue);
+ const Iterator_t& inValue,
+ bool aMaterialize = true);
virtual bool
setContextItem(const Item& inValue);
=== modified file 'src/context/dynamic_context.cpp'
--- src/context/dynamic_context.cpp 2013-08-02 18:36:02 +0000
+++ src/context/dynamic_context.cpp 2013-08-13 00:13:40 +0000
@@ -405,10 +405,13 @@
/*******************************************************************************
********************************************************************************/
-void dynamic_context::add_variable(ulong varid, store::Iterator_t& value)
+void dynamic_context::add_variable(
+ ulong varid,
+ store::Iterator_t& value,
+ bool materialize)
{
declare_variable(varid, false);
- set_variable(varid, NULL, QueryLoc::null, value);
+ set_variable(varid, NULL, QueryLoc::null, value, materialize);
}
@@ -446,7 +449,8 @@
ulong varid,
const store::Item_t& varname,
const QueryLoc& loc,
- store::Iterator_t& valueIter)
+ store::Iterator_t& valueIter,
+ bool materialize)
{
if (varid >= theVarValues.size() ||
theVarValues[varid].theState == VarValue::undeclared)
@@ -461,7 +465,7 @@
// the variable itself, and the current value of the variable is overwriten
// here by this temp sequence. TODO: use lazy eval if we know the the
// assignment expression does not reference the variable itself.
- store::TempSeq_t seq = GENV_STORE.createTempSeq(valueIter, false); // no lazy eval
+ store::TempSeq_t seq = GENV_STORE.createTempSeq(valueIter, !materialize); // no lazy eval
valueIter->close();
=== modified file 'src/context/dynamic_context.h'
--- src/context/dynamic_context.h 2013-06-11 23:38:49 +0000
+++ src/context/dynamic_context.h 2013-08-13 00:13:40 +0000
@@ -204,7 +204,7 @@
void add_variable(ulong varid, store::Item_t& value);
- void add_variable(ulong varid, store::Iterator_t& value);
+ void add_variable(ulong varid, store::Iterator_t& value, bool materialize = true);
void declare_variable(ulong varid, bool external);
@@ -218,7 +218,8 @@
ulong varid,
const store::Item_t& varname,
const QueryLoc& loc,
- store::Iterator_t& value);
+ store::Iterator_t& value,
+ bool materialize = true);
void unset_variable(
ulong varid,
=== modified file 'test/unit/CMakeLists.txt'
--- test/unit/CMakeLists.txt 2013-05-31 23:44:41 +0000
+++ test/unit/CMakeLists.txt 2013-08-13 00:13:40 +0000
@@ -97,6 +97,7 @@
xmldatamanager.cpp
staticcollectionmanager.cpp
test_static_context.cpp
+ dynamic_context.cpp
)
# multithread_simple.cpp
Follow ups