Merge lp:~zorba-coders/zorba/markos-scratch into lp:zorba

Proposed by Markos Zaharioudakis
Status: Merged
Approved by: Markos Zaharioudakis
Approved revision: 10964
Merged at revision: 11096
Proposed branch: lp:~zorba-coders/zorba/markos-scratch
Merge into: lp:zorba
Diff against target: 243 lines (+89/-74)
6 files modified
bin/zorbacmd.cpp (+16/-7)
src/api/documentmanagerimpl.cpp (+1/-3)
src/api/staticcontextimpl.cpp (+3/-1)
src/runtime/store/documents_impl.cpp (+4/-2)
src/store/naive/document_name_iterator.h (+64/-60)
src/zorbaserialization/serialize_basic_types.cpp (+1/-1)
To merge this branch: bzr merge lp:~zorba-coders/zorba/markos-scratch
Reviewer Review Type Date Requested Status
Markos Zaharioudakis Approve
Review via email: mp+129049@code.launchpad.net

Commit message

fixed bug in usage of document manager inside zorbacmd

Description of the change

fixed bug in usage of document manager inside zorbacmd

To post a comment you must log in.
Revision history for this message
Markos Zaharioudakis (markos-za) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job markos-scratch-2012-10-10T21-49-53.792Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/zorbacmd.cpp'
2--- bin/zorbacmd.cpp 2012-09-19 21:16:15 +0000
3+++ bin/zorbacmd.cpp 2012-10-10 21:34:22 +0000
4@@ -888,14 +888,23 @@
5
6 timing.startTimer(TimingInfo::UNLOAD_TIMER, i);
7
8- DocumentManager* lMgr = store->getDocumentManager();
9- ItemSequence_t lSeq = lMgr->availableDocuments();
10- Iterator_t lIter = lSeq->getIterator();
11+ DocumentManager* docMgr = store->getDocumentManager();
12+ ItemSequence_t docsSeq = docMgr->availableDocuments();
13+ Iterator_t lIter = docsSeq->getIterator();
14 lIter->open();
15- Item lURI;
16- while (lIter->next(lURI))
17- {
18- lMgr->remove(lURI.getStringValue());
19+ Item uri;
20+ std::vector<Item> docURIs;
21+ while (lIter->next(uri))
22+ {
23+ docURIs.push_back(uri);
24+ }
25+ lIter->close();
26+
27+ size_t numDocs = docURIs.size();
28+
29+ for (size_t k = 0; k < numDocs; ++k)
30+ {
31+ docMgr->remove(docURIs[k].getStringValue());
32 }
33
34 timing.stopTimer(TimingInfo::UNLOAD_TIMER, i);
35
36=== modified file 'src/api/documentmanagerimpl.cpp'
37--- src/api/documentmanagerimpl.cpp 2012-09-19 21:16:15 +0000
38+++ src/api/documentmanagerimpl.cpp 2012-10-10 21:34:22 +0000
39@@ -166,9 +166,7 @@
40 {
41 ZORBA_DM_TRY
42 {
43- Item lQName = theFactory->createQName(
44- theDocNamespace,
45- "available-documents");
46+ Item lQName = theFactory->createQName(theDocNamespace, "available-documents");
47
48 std::vector<ItemSequence_t> lArgs;
49
50
51=== modified file 'src/api/staticcontextimpl.cpp'
52--- src/api/staticcontextimpl.cpp 2012-10-08 12:09:36 +0000
53+++ src/api/staticcontextimpl.cpp 2012-10-10 21:34:22 +0000
54@@ -1507,7 +1507,9 @@
55 // contains a reference to the query in order to do cleanup work.
56 // The same is true for this sctx
57 Iterator_t lIter = impl->iterator();
58- return new InvokeItemSequence(impl.release(), lIter, const_cast<StaticContextImpl*>(this));
59+ return new InvokeItemSequence(impl.release(),
60+ lIter,
61+ const_cast<StaticContextImpl*>(this));
62 }
63 catch (ZorbaException const& e)
64 {
65
66=== modified file 'src/runtime/store/documents_impl.cpp'
67--- src/runtime/store/documents_impl.cpp 2012-09-19 21:16:15 +0000
68+++ src/runtime/store/documents_impl.cpp 2012-10-10 21:34:22 +0000
69@@ -210,7 +210,8 @@
70 void AvailableDocumentsIteratorState::reset(PlanState& planState)
71 {
72 PlanIteratorState::reset(planState);
73- if ( theNameIterator != NULL ) {
74+ if ( theNameIterator != NULL )
75+ {
76 theNameIterator->close();
77 theNameIterator = NULL;
78 }
79@@ -225,7 +226,7 @@
80 DEFAULT_STACK_INIT(AvailableDocumentsIteratorState, state, aPlanState);
81
82 state->theNameIterator = GENV_STORE.getDocumentNames();
83- state->theNameIterator->open ();
84+ state->theNameIterator->open();
85 while (state->theNameIterator->next(result))
86 {
87 STACK_PUSH( true, state);
88@@ -236,6 +237,7 @@
89 STACK_END(state);
90 }
91
92+
93 /*******************************************************************************
94 declare function
95 is-available-document() as xs:boolean
96
97=== modified file 'src/store/naive/document_name_iterator.h'
98--- src/store/naive/document_name_iterator.h 2012-09-19 21:16:15 +0000
99+++ src/store/naive/document_name_iterator.h 2012-10-10 21:34:22 +0000
100@@ -23,66 +23,70 @@
101
102 namespace simplestore {
103
104- /*******************************************************************************
105- ********************************************************************************/
106- template < typename T >
107- class DocumentNameIterator : public store::Iterator
108- {
109- private:
110- T& theItems;
111- typename T::iterator theIterator;
112- bool theOpened;
113-
114- public:
115- DocumentNameIterator(const T& aItems)
116- : theItems(*const_cast<T*>(&aItems)),
117- theOpened(false)
118- {
119- }
120-
121- virtual ~DocumentNameIterator()
122- {
123- close();
124- }
125-
126- virtual void open()
127- {
128- theIterator = theItems.begin();
129- theOpened = true;
130- }
131-
132- virtual bool next(store::Item_t& aResult)
133- {
134- if (theIterator == theItems.end())
135- {
136- aResult = NULL;
137- return false;
138- }
139- else
140- {
141- zstring lUri = (*theIterator).first;
142- GENV_ITEMFACTORY->createString(aResult, lUri);
143- ++theIterator;
144- return true;
145- }
146- }
147-
148- virtual void reset()
149- {
150- theIterator = theItems.begin();
151- }
152-
153- virtual void close()
154- {
155- if (!theOpened) {
156- return;
157- }
158-
159- theOpened = false;
160- }
161- };
162-
163- } // namespace store
164+/*******************************************************************************
165+
166+********************************************************************************/
167+template < typename T >
168+class DocumentNameIterator : public store::Iterator
169+{
170+private:
171+ T& theItems;
172+ typename T::iterator theIterator;
173+ bool theOpened;
174+
175+public:
176+ DocumentNameIterator(const T& aItems)
177+ :
178+ theItems(*const_cast<T*>(&aItems)),
179+ theOpened(false)
180+ {
181+ }
182+
183+ virtual ~DocumentNameIterator()
184+ {
185+ close();
186+ }
187+
188+ virtual void open()
189+ {
190+ theIterator = theItems.begin();
191+ theOpened = true;
192+ }
193+
194+ virtual bool next(store::Item_t& aResult)
195+ {
196+ if (theIterator == theItems.end())
197+ {
198+ aResult = NULL;
199+ return false;
200+ }
201+ else
202+ {
203+ zstring lUri = (*theIterator).first;
204+ GENV_ITEMFACTORY->createString(aResult, lUri);
205+ ++theIterator;
206+ return true;
207+ }
208+ }
209+
210+ virtual void reset()
211+ {
212+ theIterator = theItems.begin();
213+ }
214+
215+ virtual void close()
216+ {
217+ if (!theOpened)
218+ {
219+ return;
220+ }
221+
222+ theOpened = false;
223+ }
224+};
225+
226+
227+} // namespace store
228 } // namespace zorba
229
230
231
232=== modified file 'src/zorbaserialization/serialize_basic_types.cpp'
233--- src/zorbaserialization/serialize_basic_types.cpp 2012-09-19 21:16:15 +0000
234+++ src/zorbaserialization/serialize_basic_types.cpp 2012-10-10 21:34:22 +0000
235@@ -377,7 +377,7 @@
236 if (ar.is_serializing_out())
237 {
238 FloatImpl<float> zorba_float(obj);
239- zstring float_str = zorba_float.toString();
240+ zstring float_str = zorba_float.toString();
241
242 if (isdigit(float_str.c_str()[0]))
243 {

Subscribers

People subscribed via source and target branches