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 on 2013-08-13

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
1=== modified file 'include/zorba/dynamic_context.h'
2--- include/zorba/dynamic_context.h 2013-08-01 07:58:48 +0000
3+++ include/zorba/dynamic_context.h 2013-08-13 00:13:40 +0000
4@@ -102,13 +102,16 @@
5 * @param aQName the QName that identifies the external variable.
6 * @param aIterator the Iterator producing the sequence that is assigned
7 * to the variable.
8+ * @param aMaterialize determines whether the result of the iterator should
9+ * be materialized before binding it to the variable.
10 * @return true if the variable has been set successfully, false otherwise.
11 * @throw ZorbaException if an error occured (e.g. the given Iterator is not valid).
12 */
13 virtual bool
14 setVariable(
15 const String& aQName,
16- const Iterator_t& aIterator) = 0;
17+ const Iterator_t& aIterator,
18+ bool aMaterialize = true) = 0;
19
20 /**
21 * \brief Defines the external variable identified by an expanded QName and
22@@ -121,6 +124,8 @@
23 * @param aLocalname the local name of the variable's expanded QName
24 * @param aIterator the Iterator producing the sequence that is assigned
25 * to the variable.
26+ * @param aMaterialize determines whether the result of the iterator should
27+ * be materialized before binding it to the variable.
28 * @return true if the variable has been set successfully, false otherwise.
29 * @throw ZorbaException if an error occured (e.g. the given Iterator is not valid).
30 */
31@@ -128,7 +133,8 @@
32 setVariable(
33 const String& aNamespace,
34 const String& aLocalname,
35- const Iterator_t& aIterator) = 0;
36+ const Iterator_t& aIterator,
37+ bool aMaterialize = true) = 0;
38
39 /** \brief Returns the current value of an external
40 * variable. Exactly one of the two return values (aItem or
41
42=== modified file 'src/api/dynamiccontextimpl.cpp'
43--- src/api/dynamiccontextimpl.cpp 2013-08-01 17:23:58 +0000
44+++ src/api/dynamiccontextimpl.cpp 2013-08-13 00:13:40 +0000
45@@ -232,7 +232,8 @@
46 ********************************************************************************/
47 bool DynamicContextImpl::setVariable(
48 const String& inVarName,
49- const Iterator_t& inValue)
50+ const Iterator_t& inValue,
51+ bool aMaterialize)
52 {
53 ZORBA_DCTX_TRY
54 {
55@@ -267,7 +268,7 @@
56
57 ulong varId = var->getId();
58
59- theCtx->add_variable(varId, value);
60+ theCtx->add_variable(varId, value, aMaterialize);
61
62 return true;
63 }
64@@ -282,7 +283,8 @@
65 bool DynamicContextImpl::setVariable(
66 const String& inNamespace,
67 const String& inLocalname,
68- const Iterator_t& inValue)
69+ const Iterator_t& inValue,
70+ bool aMaterialize)
71 {
72 ZORBA_DCTX_TRY
73 {
74@@ -319,7 +321,7 @@
75
76 ulong varId = var->getId();
77
78- theCtx->add_variable(varId, value);
79+ theCtx->add_variable(varId, value, aMaterialize);
80
81 return true;
82 }
83
84=== modified file 'src/api/dynamiccontextimpl.h'
85--- src/api/dynamiccontextimpl.h 2013-08-01 07:57:57 +0000
86+++ src/api/dynamiccontextimpl.h 2013-08-13 00:13:40 +0000
87@@ -107,13 +107,15 @@
88 virtual bool
89 setVariable(
90 const String& inVarName,
91- const Iterator_t& inValue);
92+ const Iterator_t& inValue,
93+ bool aMaterialize = true);
94
95 virtual bool
96 setVariable(
97 const String& inNamespace,
98 const String& inLocalname,
99- const Iterator_t& inValue);
100+ const Iterator_t& inValue,
101+ bool aMaterialize = true);
102
103 virtual bool
104 setContextItem(const Item& inValue);
105
106=== modified file 'src/context/dynamic_context.cpp'
107--- src/context/dynamic_context.cpp 2013-08-02 18:36:02 +0000
108+++ src/context/dynamic_context.cpp 2013-08-13 00:13:40 +0000
109@@ -405,10 +405,13 @@
110 /*******************************************************************************
111
112 ********************************************************************************/
113-void dynamic_context::add_variable(ulong varid, store::Iterator_t& value)
114+void dynamic_context::add_variable(
115+ ulong varid,
116+ store::Iterator_t& value,
117+ bool materialize)
118 {
119 declare_variable(varid, false);
120- set_variable(varid, NULL, QueryLoc::null, value);
121+ set_variable(varid, NULL, QueryLoc::null, value, materialize);
122 }
123
124
125@@ -446,7 +449,8 @@
126 ulong varid,
127 const store::Item_t& varname,
128 const QueryLoc& loc,
129- store::Iterator_t& valueIter)
130+ store::Iterator_t& valueIter,
131+ bool materialize)
132 {
133 if (varid >= theVarValues.size() ||
134 theVarValues[varid].theState == VarValue::undeclared)
135@@ -461,7 +465,7 @@
136 // the variable itself, and the current value of the variable is overwriten
137 // here by this temp sequence. TODO: use lazy eval if we know the the
138 // assignment expression does not reference the variable itself.
139- store::TempSeq_t seq = GENV_STORE.createTempSeq(valueIter, false); // no lazy eval
140+ store::TempSeq_t seq = GENV_STORE.createTempSeq(valueIter, !materialize); // no lazy eval
141
142 valueIter->close();
143
144
145=== modified file 'src/context/dynamic_context.h'
146--- src/context/dynamic_context.h 2013-06-11 23:38:49 +0000
147+++ src/context/dynamic_context.h 2013-08-13 00:13:40 +0000
148@@ -204,7 +204,7 @@
149
150 void add_variable(ulong varid, store::Item_t& value);
151
152- void add_variable(ulong varid, store::Iterator_t& value);
153+ void add_variable(ulong varid, store::Iterator_t& value, bool materialize = true);
154
155 void declare_variable(ulong varid, bool external);
156
157@@ -218,7 +218,8 @@
158 ulong varid,
159 const store::Item_t& varname,
160 const QueryLoc& loc,
161- store::Iterator_t& value);
162+ store::Iterator_t& value,
163+ bool materialize = true);
164
165 void unset_variable(
166 ulong varid,
167
168=== modified file 'test/unit/CMakeLists.txt'
169--- test/unit/CMakeLists.txt 2013-05-31 23:44:41 +0000
170+++ test/unit/CMakeLists.txt 2013-08-13 00:13:40 +0000
171@@ -97,6 +97,7 @@
172 xmldatamanager.cpp
173 staticcollectionmanager.cpp
174 test_static_context.cpp
175+ dynamic_context.cpp
176 )
177
178 # multithread_simple.cpp

Subscribers

People subscribed via source and target branches