Merge lp:~zorba-coders/zorba/feature-no-mat-setVariable into lp:zorba

Proposed by Matthias Brantner
Status: Rejected
Rejected by: Matthias Brantner
Proposed branch: lp:~zorba-coders/zorba/feature-no-mat-setVariable
Merge into: lp:zorba
Diff against target: 178 lines (+30/-14)
6 files modified
include/zorba/dynamic_context.h (+8/-2)
src/api/dynamiccontextimpl.cpp (+6/-4)
src/api/dynamiccontextimpl.h (+4/-2)
src/context/dynamic_context.cpp (+8/-4)
src/context/dynamic_context.h (+3/-2)
test/unit/CMakeLists.txt (+1/-0)
To merge this branch: bzr merge lp:~zorba-coders/zorba/feature-no-mat-setVariable
Reviewer Review Type Date Requested Status
Matthias Brantner Pending
Review via email: mp+179831@code.launchpad.net

Commit message

non-materializing query chaining using DynamicContext::setVariable

Description of the change

non-materializing query chaining using DynamicContext::setVariable

To post a comment you must log in.

Unmerged revisions

11597. By Matthias Brantner

expose materialization flag for DynamicContext::setVariable and added a test

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== 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 @@
102 * @param aQName the QName that identifies the external variable.102 * @param aQName the QName that identifies the external variable.
103 * @param aIterator the Iterator producing the sequence that is assigned103 * @param aIterator the Iterator producing the sequence that is assigned
104 * to the variable.104 * to the variable.
105 * @param aMaterialize determines whether the result of the iterator should
106 * be materialized before binding it to the variable.
105 * @return true if the variable has been set successfully, false otherwise.107 * @return true if the variable has been set successfully, false otherwise.
106 * @throw ZorbaException if an error occured (e.g. the given Iterator is not valid).108 * @throw ZorbaException if an error occured (e.g. the given Iterator is not valid).
107 */109 */
108 virtual bool110 virtual bool
109 setVariable( 111 setVariable(
110 const String& aQName,112 const String& aQName,
111 const Iterator_t& aIterator) = 0;113 const Iterator_t& aIterator,
114 bool aMaterialize = true) = 0;
112115
113 /** 116 /**
114 * \brief Defines the external variable identified by an expanded QName and117 * \brief Defines the external variable identified by an expanded QName and
@@ -121,6 +124,8 @@
121 * @param aLocalname the local name of the variable's expanded QName124 * @param aLocalname the local name of the variable's expanded QName
122 * @param aIterator the Iterator producing the sequence that is assigned125 * @param aIterator the Iterator producing the sequence that is assigned
123 * to the variable.126 * to the variable.
127 * @param aMaterialize determines whether the result of the iterator should
128 * be materialized before binding it to the variable.
124 * @return true if the variable has been set successfully, false otherwise.129 * @return true if the variable has been set successfully, false otherwise.
125 * @throw ZorbaException if an error occured (e.g. the given Iterator is not valid).130 * @throw ZorbaException if an error occured (e.g. the given Iterator is not valid).
126 */131 */
@@ -128,7 +133,8 @@
128 setVariable( 133 setVariable(
129 const String& aNamespace,134 const String& aNamespace,
130 const String& aLocalname,135 const String& aLocalname,
131 const Iterator_t& aIterator) = 0;136 const Iterator_t& aIterator,
137 bool aMaterialize = true) = 0;
132138
133 /** \brief Returns the current value of an external139 /** \brief Returns the current value of an external
134 * variable. Exactly one of the two return values (aItem or140 * variable. Exactly one of the two return values (aItem or
135141
=== 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 @@
232********************************************************************************/232********************************************************************************/
233bool DynamicContextImpl::setVariable(233bool DynamicContextImpl::setVariable(
234 const String& inVarName,234 const String& inVarName,
235 const Iterator_t& inValue)235 const Iterator_t& inValue,
236 bool aMaterialize)
236{237{
237 ZORBA_DCTX_TRY238 ZORBA_DCTX_TRY
238 {239 {
@@ -267,7 +268,7 @@
267268
268 ulong varId = var->getId();269 ulong varId = var->getId();
269270
270 theCtx->add_variable(varId, value);271 theCtx->add_variable(varId, value, aMaterialize);
271272
272 return true;273 return true;
273 }274 }
@@ -282,7 +283,8 @@
282bool DynamicContextImpl::setVariable(283bool DynamicContextImpl::setVariable(
283 const String& inNamespace,284 const String& inNamespace,
284 const String& inLocalname,285 const String& inLocalname,
285 const Iterator_t& inValue)286 const Iterator_t& inValue,
287 bool aMaterialize)
286{288{
287 ZORBA_DCTX_TRY289 ZORBA_DCTX_TRY
288 {290 {
@@ -319,7 +321,7 @@
319321
320 ulong varId = var->getId();322 ulong varId = var->getId();
321323
322 theCtx->add_variable(varId, value);324 theCtx->add_variable(varId, value, aMaterialize);
323325
324 return true;326 return true;
325 }327 }
326328
=== 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 @@
107 virtual bool107 virtual bool
108 setVariable(108 setVariable(
109 const String& inVarName,109 const String& inVarName,
110 const Iterator_t& inValue);110 const Iterator_t& inValue,
111 bool aMaterialize = true);
111112
112 virtual bool113 virtual bool
113 setVariable(114 setVariable(
114 const String& inNamespace,115 const String& inNamespace,
115 const String& inLocalname,116 const String& inLocalname,
116 const Iterator_t& inValue);117 const Iterator_t& inValue,
118 bool aMaterialize = true);
117119
118 virtual bool120 virtual bool
119 setContextItem(const Item& inValue);121 setContextItem(const Item& inValue);
120122
=== 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 @@
405/*******************************************************************************405/*******************************************************************************
406406
407********************************************************************************/407********************************************************************************/
408void dynamic_context::add_variable(ulong varid, store::Iterator_t& value)408void dynamic_context::add_variable(
409 ulong varid,
410 store::Iterator_t& value,
411 bool materialize)
409{412{
410 declare_variable(varid, false);413 declare_variable(varid, false);
411 set_variable(varid, NULL, QueryLoc::null, value);414 set_variable(varid, NULL, QueryLoc::null, value, materialize);
412}415}
413416
414417
@@ -446,7 +449,8 @@
446 ulong varid,449 ulong varid,
447 const store::Item_t& varname,450 const store::Item_t& varname,
448 const QueryLoc& loc,451 const QueryLoc& loc,
449 store::Iterator_t& valueIter)452 store::Iterator_t& valueIter,
453 bool materialize)
450{454{
451 if (varid >= theVarValues.size() ||455 if (varid >= theVarValues.size() ||
452 theVarValues[varid].theState == VarValue::undeclared)456 theVarValues[varid].theState == VarValue::undeclared)
@@ -461,7 +465,7 @@
461 // the variable itself, and the current value of the variable is overwriten465 // the variable itself, and the current value of the variable is overwriten
462 // here by this temp sequence. TODO: use lazy eval if we know the the466 // here by this temp sequence. TODO: use lazy eval if we know the the
463 // assignment expression does not reference the variable itself.467 // assignment expression does not reference the variable itself.
464 store::TempSeq_t seq = GENV_STORE.createTempSeq(valueIter, false); // no lazy eval468 store::TempSeq_t seq = GENV_STORE.createTempSeq(valueIter, !materialize); // no lazy eval
465469
466 valueIter->close();470 valueIter->close();
467471
468472
=== 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 @@
204204
205 void add_variable(ulong varid, store::Item_t& value);205 void add_variable(ulong varid, store::Item_t& value);
206206
207 void add_variable(ulong varid, store::Iterator_t& value);207 void add_variable(ulong varid, store::Iterator_t& value, bool materialize = true);
208208
209 void declare_variable(ulong varid, bool external);209 void declare_variable(ulong varid, bool external);
210210
@@ -218,7 +218,8 @@
218 ulong varid,218 ulong varid,
219 const store::Item_t& varname,219 const store::Item_t& varname,
220 const QueryLoc& loc,220 const QueryLoc& loc,
221 store::Iterator_t& value);221 store::Iterator_t& value,
222 bool materialize = true);
222223
223 void unset_variable(224 void unset_variable(
224 ulong varid,225 ulong varid,
225226
=== 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 @@
97 xmldatamanager.cpp97 xmldatamanager.cpp
98 staticcollectionmanager.cpp98 staticcollectionmanager.cpp
99 test_static_context.cpp99 test_static_context.cpp
100 dynamic_context.cpp
100)101)
101102
102# multithread_simple.cpp103# multithread_simple.cpp

Subscribers

People subscribed via source and target branches