Merge lp:~zorba-coders/zorba/markos-scratch into lp:zorba
- markos-scratch
- Merge into trunk
Proposed by
Markos Zaharioudakis
Status: | Merged |
---|---|
Merged at revision: | 11575 |
Proposed branch: | lp:~zorba-coders/zorba/markos-scratch |
Merge into: | lp:zorba |
Diff against target: |
453 lines (+164/-163) 5 files modified
src/api/item_seq_chainer.cpp (+1/-1) src/api/item_seq_chainer.h (+70/-70) src/api/staticcollectionmanagerimpl.cpp (+1/-1) src/runtime/store/documents_impl.cpp (+90/-91) src/store/api/store.h (+2/-0) |
To merge this branch: | bzr merge lp:~zorba-coders/zorba/markos-scratch |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Markos Zaharioudakis | Approve | ||
Review via email: mp+178048@code.launchpad.net |
Commit message
renamed item_sequence_
Description of the change
renamed item_sequence_
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 succeeded - proposal merged!
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/api/item_seq_chainer.cpp' |
2 | --- src/api/item_seq_chainer.cpp 2013-08-01 11:24:18 +0000 |
3 | +++ src/api/item_seq_chainer.cpp 2013-08-01 12:01:31 +0000 |
4 | @@ -16,7 +16,7 @@ |
5 | #include "stdafx.h" |
6 | |
7 | #include <zorba/iterator.h> |
8 | -#include "api/item_sequence_chainer.h" |
9 | +#include "api/item_seq_chainer.h" |
10 | #include <cassert> |
11 | |
12 | namespace zorba { |
13 | |
14 | === renamed file 'src/api/item_sequence_chainer.h' => 'src/api/item_seq_chainer.h' |
15 | --- src/api/item_sequence_chainer.h 2013-02-07 17:24:36 +0000 |
16 | +++ src/api/item_seq_chainer.h 2013-08-01 12:01:31 +0000 |
17 | @@ -29,84 +29,84 @@ |
18 | |
19 | namespace zorba { |
20 | |
21 | - /** \brief |
22 | - * |
23 | - * See ItemSequence |
24 | +/** \brief |
25 | + * |
26 | + * See ItemSequence |
27 | + */ |
28 | +class ZORBA_DLL_PUBLIC ItemSequenceChainer : public ItemSequence |
29 | +{ |
30 | + public: |
31 | + /** |
32 | */ |
33 | - class ZORBA_DLL_PUBLIC ItemSequenceChainer : public ItemSequence |
34 | - { |
35 | - public: |
36 | - /** |
37 | - */ |
38 | - ItemSequenceChainer( |
39 | + ItemSequenceChainer( |
40 | const std::vector<ItemSequence_t>& aSequences, |
41 | bool aDoDupElim = false); |
42 | |
43 | - /** \brief Destructor |
44 | - */ |
45 | - virtual ~ItemSequenceChainer(); |
46 | - |
47 | - /** \brief get the Iterator over the items |
48 | - * @return an iterator over the items |
49 | - */ |
50 | - virtual Iterator_t getIterator(); |
51 | - |
52 | - protected: |
53 | - std::vector<ItemSequence_t> theSequences; |
54 | - bool theDoDupElim; |
55 | - |
56 | - protected: |
57 | - class Iterator : public zorba::Iterator |
58 | - { |
59 | - public: |
60 | - Iterator( |
61 | + /** \brief Destructor |
62 | + */ |
63 | + virtual ~ItemSequenceChainer(); |
64 | + |
65 | + /** \brief get the Iterator over the items |
66 | + * @return an iterator over the items |
67 | + */ |
68 | + virtual Iterator_t getIterator(); |
69 | + |
70 | + protected: |
71 | + std::vector<ItemSequence_t> theSequences; |
72 | + bool theDoDupElim; |
73 | + |
74 | + protected: |
75 | + class Iterator : public zorba::Iterator |
76 | + { |
77 | + public: |
78 | + Iterator( |
79 | const std::vector<ItemSequence_t>& aSequences, |
80 | bool aDoDupElim); |
81 | |
82 | - virtual ~Iterator(); |
83 | - |
84 | - virtual void |
85 | - open(); |
86 | - |
87 | - virtual bool |
88 | - next(Item& aItem); |
89 | + virtual ~Iterator(); |
90 | + |
91 | + virtual void |
92 | + open(); |
93 | + |
94 | + virtual bool |
95 | + next(Item& aItem); |
96 | |
97 | - virtual void |
98 | - close(); |
99 | - |
100 | - virtual bool |
101 | - isOpen() const; |
102 | - |
103 | - protected: |
104 | - std::vector<ItemSequence_t> theSequences; |
105 | - std::vector<ItemSequence_t>::iterator theSeqIter; |
106 | - zorba::Iterator_t theIter; |
107 | - bool theIsOpen; |
108 | - bool theDoDupElim; |
109 | - |
110 | - struct Comparator { |
111 | - bool operator()(const Item& i1, const Item& i2) const |
112 | - { |
113 | - assert(i1.getType().getLocalName() == "QName"); |
114 | - assert(i2.getType().getLocalName() == "QName"); |
115 | - int lNamespaceComparison = i1.getNamespace().compare(i2.getNamespace()); |
116 | - if (lNamespaceComparison < 0) |
117 | - { |
118 | - return true; |
119 | - } |
120 | - if (lNamespaceComparison > 0) |
121 | - { |
122 | - return false; |
123 | - } |
124 | - // Namespaces are equal, comparing local names. |
125 | - return (i1.getLocalName().compare(i2.getLocalName()) < 0); |
126 | - } |
127 | - }; |
128 | - |
129 | - std::set<Item, Comparator> theDupElimSet; |
130 | - }; |
131 | - }; /* class ItemSequenceChainer */ |
132 | - |
133 | + virtual void |
134 | + close(); |
135 | + |
136 | + virtual bool |
137 | + isOpen() const; |
138 | + |
139 | + protected: |
140 | + std::vector<ItemSequence_t> theSequences; |
141 | + std::vector<ItemSequence_t>::iterator theSeqIter; |
142 | + zorba::Iterator_t theIter; |
143 | + bool theIsOpen; |
144 | + bool theDoDupElim; |
145 | + |
146 | + struct Comparator { |
147 | + bool operator()(const Item& i1, const Item& i2) const |
148 | + { |
149 | + assert(i1.getType().getLocalName() == "QName"); |
150 | + assert(i2.getType().getLocalName() == "QName"); |
151 | + int lNamespaceComparison = i1.getNamespace().compare(i2.getNamespace()); |
152 | + if (lNamespaceComparison < 0) |
153 | + { |
154 | + return true; |
155 | + } |
156 | + if (lNamespaceComparison > 0) |
157 | + { |
158 | + return false; |
159 | + } |
160 | + // Namespaces are equal, comparing local names. |
161 | + return (i1.getLocalName().compare(i2.getLocalName()) < 0); |
162 | + } |
163 | + }; |
164 | + |
165 | + std::set<Item, Comparator> theDupElimSet; |
166 | + }; |
167 | +}; /* class ItemSequenceChainer */ |
168 | + |
169 | } // namespace zorba |
170 | #endif |
171 | |
172 | |
173 | === modified file 'src/api/staticcollectionmanagerimpl.cpp' |
174 | --- src/api/staticcollectionmanagerimpl.cpp 2013-02-07 17:24:36 +0000 |
175 | +++ src/api/staticcollectionmanagerimpl.cpp 2013-08-01 12:01:31 +0000 |
176 | @@ -27,7 +27,7 @@ |
177 | #include <zorba/diagnostic_list.h> |
178 | |
179 | #include "api/collectionmanagerimpl.h" |
180 | -#include "api/item_sequence_chainer.h" |
181 | +#include "api/item_seq_chainer.h" |
182 | #include "api/collectionimpl.h" |
183 | #include "api/unmarshaller.h" |
184 | #include "api/zorbaimpl.h" |
185 | |
186 | === modified file 'src/runtime/store/documents_impl.cpp' |
187 | --- src/runtime/store/documents_impl.cpp 2013-02-07 17:24:36 +0000 |
188 | +++ src/runtime/store/documents_impl.cpp 2013-08-01 12:01:31 +0000 |
189 | @@ -16,6 +16,7 @@ |
190 | #include "stdafx.h" |
191 | |
192 | #include "diagnostics/assert.h" |
193 | +#include "diagnostics/util_macros.h" |
194 | #include "diagnostics/xquery_diagnostics.h" |
195 | |
196 | #include "zorbatypes/URI.h" |
197 | @@ -55,24 +56,22 @@ |
198 | consumeNext(lUri, theChildren[0].getp(), aPlanState); |
199 | |
200 | // absolutize retrieved uri |
201 | - try { |
202 | + try |
203 | + { |
204 | lUri->getStringValue2(lRetrievedUriString); |
205 | lResolvedUriString = theSctx->resolve_relative_uri(lRetrievedUriString, true); |
206 | - } catch (ZorbaException const&) { |
207 | - throw XQUERY_EXCEPTION( |
208 | - err::FODC0004, |
209 | - ERROR_PARAMS( lResolvedUriString, ZED( NoResolveRelativeURI ) ), |
210 | - ERROR_LOC( loc ) |
211 | - ); |
212 | + } |
213 | + catch (ZorbaException const&) |
214 | + { |
215 | + RAISE_ERROR(err::FODC0004, loc, |
216 | + ERROR_PARAMS(lResolvedUriString, ZED(NoResolveRelativeURI))); |
217 | } |
218 | |
219 | // check if document already exists in the store |
220 | - if (GENV_STORE.getDocument(lResolvedUriString) != NULL) { |
221 | - throw XQUERY_EXCEPTION( |
222 | - zerr::ZAPI0020_DOCUMENT_ALREADY_EXISTS, |
223 | - ERROR_PARAMS( lResolvedUriString ), |
224 | - ERROR_LOC( loc ) |
225 | - ); |
226 | + if (GENV_STORE.getDocument(lResolvedUriString) != NULL) |
227 | + { |
228 | + RAISE_ERROR(zerr::ZAPI0020_DOCUMENT_ALREADY_EXISTS, loc, |
229 | + ERROR_PARAMS(lResolvedUriString)); |
230 | } |
231 | |
232 | // create the pul and add the primitive |
233 | @@ -89,6 +88,7 @@ |
234 | STACK_END(state); |
235 | } |
236 | |
237 | + |
238 | /******************************************************************************* |
239 | declare updating function |
240 | remove($uri as xs:string) as empty-sequence() |
241 | @@ -101,7 +101,7 @@ |
242 | zstring lResolvedUriString; |
243 | store::Item_t lUri; |
244 | store::Item_t lResolvedUriItem; |
245 | - std::auto_ptr<store::PUL> lPul; |
246 | + store::PUL_t lPul; |
247 | |
248 | PlanIteratorState* state; |
249 | DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState); |
250 | @@ -109,39 +109,38 @@ |
251 | consumeNext(lUri, theChildren[0].getp(), aPlanState); |
252 | |
253 | // absolutize retrieved uri |
254 | - try { |
255 | + try |
256 | + { |
257 | lUri->getStringValue2(lRetrievedUriString); |
258 | lResolvedUriString = theSctx->resolve_relative_uri(lRetrievedUriString, true); |
259 | - } catch (ZorbaException const&) { |
260 | - throw XQUERY_EXCEPTION( |
261 | - err::FODC0004, |
262 | - ERROR_PARAMS( lResolvedUriString, ZED( NoResolveRelativeURI ) ), |
263 | - ERROR_LOC( loc ) |
264 | - ); |
265 | + } |
266 | + catch (ZorbaException const&) |
267 | + { |
268 | + RAISE_ERROR(err::FODC0004, loc, |
269 | + ERROR_PARAMS(lResolvedUriString, ZED(NoResolveRelativeURI))); |
270 | } |
271 | |
272 | // check if document exists in the store |
273 | - if (GENV_STORE.getDocument(lResolvedUriString) == NULL) { |
274 | - throw XQUERY_EXCEPTION( |
275 | - zerr::ZXQD0002_DOCUMENT_NOT_VALID, |
276 | - ERROR_PARAMS( lResolvedUriString, ZED( NoURIInStore ) ), |
277 | - ERROR_LOC( loc ) |
278 | - ); |
279 | + if (GENV_STORE.getDocument(lResolvedUriString) == NULL) |
280 | + { |
281 | + RAISE_ERROR(zerr::ZXQD0002_DOCUMENT_NOT_VALID, loc, |
282 | + ERROR_PARAMS(lResolvedUriString, ZED(NoURIInStore))); |
283 | } |
284 | |
285 | // create the pul and add the primitive |
286 | GENV_ITEMFACTORY->createAnyURI(lResolvedUriItem, lResolvedUriString); |
287 | |
288 | - lPul.reset(GENV_ITEMFACTORY->createPendingUpdateList()); |
289 | + lPul = GENV_ITEMFACTORY->createPendingUpdateList(); |
290 | |
291 | lPul->addDeleteDocument(&loc, lResolvedUriItem); |
292 | |
293 | - result = lPul.release(); |
294 | + result.transfer(lPul); |
295 | STACK_PUSH(result != NULL, state); |
296 | |
297 | STACK_END(state); |
298 | } |
299 | |
300 | + |
301 | /******************************************************************************* |
302 | declare function |
303 | document($uri as xs:string) as document-node() |
304 | @@ -161,30 +160,68 @@ |
305 | consumeNext(lUri, theChildren[0].getp(), aPlanState); |
306 | |
307 | // absolutize retrieved uri |
308 | - try { |
309 | - lUri->getStringValue2(lRetrievedUriString); |
310 | - lResolvedUriString = theSctx->resolve_relative_uri(lRetrievedUriString, true); |
311 | - } catch (ZorbaException const&) { |
312 | - throw XQUERY_EXCEPTION( |
313 | - err::FODC0004, |
314 | - ERROR_PARAMS( lResolvedUriString, ZED( NoResolveRelativeURI ) ), |
315 | - ERROR_LOC( loc ) |
316 | - ); |
317 | - } |
318 | - |
319 | - // check if document exists in the store |
320 | - if ((result = GENV_STORE.getDocument(lResolvedUriString)) == NULL) { |
321 | - throw XQUERY_EXCEPTION( |
322 | - zerr::ZXQD0002_DOCUMENT_NOT_VALID, |
323 | - ERROR_PARAMS( lResolvedUriString, ZED( NoURIInStore ) ), |
324 | - ERROR_LOC( loc ) |
325 | - ); |
326 | - } |
327 | - |
328 | - STACK_PUSH(true, state); |
329 | - |
330 | - STACK_END(state); |
331 | -} |
332 | + try |
333 | + { |
334 | + lUri->getStringValue2(lRetrievedUriString); |
335 | + lResolvedUriString = theSctx->resolve_relative_uri(lRetrievedUriString, true); |
336 | + } |
337 | + catch (ZorbaException const&) |
338 | + { |
339 | + RAISE_ERROR(err::FODC0004, loc, |
340 | + ERROR_PARAMS(lResolvedUriString, ZED( NoResolveRelativeURI))); |
341 | + } |
342 | + |
343 | + // check if document exists in the store |
344 | + if ((result = GENV_STORE.getDocument(lResolvedUriString)) == NULL) |
345 | + { |
346 | + RAISE_ERROR(zerr::ZXQD0002_DOCUMENT_NOT_VALID, loc, |
347 | + ERROR_PARAMS(lResolvedUriString, ZED( NoURIInStore))); |
348 | + } |
349 | + |
350 | + STACK_PUSH(true, state); |
351 | + |
352 | + STACK_END(state); |
353 | +} |
354 | + |
355 | + |
356 | +/******************************************************************************* |
357 | + declare function |
358 | + is-available-document($uri as xs:string) as xs:boolean |
359 | +********************************************************************************/ |
360 | +bool IsAvailableDocumentIterator::nextImpl( |
361 | + store::Item_t& result, |
362 | + PlanState& aPlanState) const |
363 | +{ |
364 | + zstring lRetrievedUriString; |
365 | + zstring lResolvedUriString; |
366 | + store::Item_t lUri; |
367 | + |
368 | + PlanIteratorState* state; |
369 | + DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState); |
370 | + |
371 | + consumeNext(lUri, theChildren[0].getp(), aPlanState); |
372 | + |
373 | + // absolutize retrieved uri |
374 | + try |
375 | + { |
376 | + lUri->getStringValue2(lRetrievedUriString); |
377 | + lResolvedUriString = theSctx->resolve_relative_uri(lRetrievedUriString, true); |
378 | + } |
379 | + catch (ZorbaException const&) |
380 | + { |
381 | + RAISE_ERROR(err::FODC0004, loc, |
382 | + ERROR_PARAMS(lResolvedUriString, ZED(NoResolveRelativeURI))); |
383 | + } |
384 | + |
385 | + // check if document exists in the store |
386 | + GENV_ITEMFACTORY-> |
387 | + createBoolean(result, GENV_STORE.getDocument(lResolvedUriString) != NULL); |
388 | + |
389 | + STACK_PUSH(true, state); |
390 | + |
391 | + STACK_END(state); |
392 | +} |
393 | + |
394 | |
395 | /******************************************************************************* |
396 | declare function |
397 | @@ -238,43 +275,5 @@ |
398 | } |
399 | |
400 | |
401 | -/******************************************************************************* |
402 | - declare function |
403 | - is-available-document() as xs:boolean |
404 | -********************************************************************************/ |
405 | -bool IsAvailableDocumentIterator::nextImpl( |
406 | - store::Item_t& result, |
407 | - PlanState& aPlanState) const |
408 | -{ |
409 | - zstring lRetrievedUriString; |
410 | - zstring lResolvedUriString; |
411 | - store::Item_t lUri; |
412 | - |
413 | - PlanIteratorState* state; |
414 | - DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState); |
415 | - |
416 | - consumeNext(lUri, theChildren[0].getp(), aPlanState); |
417 | - |
418 | - // absolutize retrieved uri |
419 | - try { |
420 | - lUri->getStringValue2(lRetrievedUriString); |
421 | - lResolvedUriString = theSctx->resolve_relative_uri(lRetrievedUriString, true); |
422 | - } catch (ZorbaException const&) { |
423 | - throw XQUERY_EXCEPTION( |
424 | - err::FODC0004, |
425 | - ERROR_PARAMS( lResolvedUriString, ZED( NoResolveRelativeURI ) ), |
426 | - ERROR_LOC( loc ) |
427 | - ); |
428 | - } |
429 | - |
430 | - // check if document exists in the store |
431 | - GENV_ITEMFACTORY->createBoolean( |
432 | - result, GENV_STORE.getDocument(lResolvedUriString) != NULL); |
433 | - |
434 | - STACK_PUSH(true, state); |
435 | - |
436 | - STACK_END(state); |
437 | -} |
438 | - |
439 | } // namespace zorba |
440 | /* vim:set et sw=2 ts=2: */ |
441 | |
442 | === modified file 'src/store/api/store.h' |
443 | --- src/store/api/store.h 2013-02-07 17:24:36 +0000 |
444 | +++ src/store/api/store.h 2013-08-01 12:01:31 +0000 |
445 | @@ -250,6 +250,8 @@ |
446 | |
447 | virtual void addNode(const zstring& uri, const Item_t& node) = 0; |
448 | |
449 | + virtual void deleteDocument(const zstring& uri) = 0; |
450 | + |
451 | virtual Iterator_t getDocumentNames() const = 0; |
452 | |
453 | /* ------------------------ Collection Management ---------------------------*/ |
Validation queue starting for the following merge proposals: /code.launchpad .net/~zorba- coders/ zorba/markos- scratch/ +merge/ 178048
https:/
Progress dashboard at http:// jenkins. lambda. nu/view/ ValidationQueue