Merge lp:~zorba-coders/zorba/bug-945241 into lp:zorba

Proposed by Matthias Brantner
Status: Superseded
Proposed branch: lp:~zorba-coders/zorba/bug-945241
Merge into: lp:zorba
Diff against target: 194 lines (+87/-23)
5 files modified
ChangeLog (+1/-0)
src/runtime/collections/collections_impl.cpp (+11/-5)
test/unit/module1.xq (+1/-1)
test/unit/module2.xq (+11/-0)
test/unit/staticcollectionmanager.cpp (+63/-17)
To merge this branch: bzr merge lp:~zorba-coders/zorba/bug-945241
Reviewer Review Type Date Requested Status
Matthias Brantner Pending
Till Westmann Pending
Review via email: mp+95702@code.launchpad.net

This proposal supersedes a proposal from 2012-03-02.

This proposal has been superseded by a proposal from 2012-03-02.

Commit message

fix bug #945241 (StaticCollectionManager::declaredIndexes() and temporary indexes)

Description of the change

StaticCollectionManager::declaredIndexes() doesn't return temporary indexes anymore. Also isDeclaredIndex also doesn't return true if asked whether a temporary index is declared.

To post a comment you must log in.
Revision history for this message
Matthias Brantner (matthias-brantner) : Posted in a previous version of this proposal
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

The attempt to merge lp:~zorba-coders/zorba/bug-945241 into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:274 (message):
  Validation queue job bug-945241-2012-03-02T23-40-07.785Z is finished. The
  final status was:

  No tests were run - build or configure step must have failed.

  Not commiting changes.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/bug-945241 into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:274 (message):
  Validation queue job bug-945241-2012-03-02T23-52-06.271Z is finished. The
  final status was:

  No tests were run - build or configure step must have failed.

  Not commiting changes.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

lp:~zorba-coders/zorba/bug-945241 updated
10690. By Matthias Brantner

merge

10691. By Matthias Brantner

fixed bug that occurred during the merge

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ChangeLog'
--- ChangeLog 2012-03-01 21:22:16 +0000
+++ ChangeLog 2012-03-02 23:51:19 +0000
@@ -24,6 +24,7 @@
24 case of early-out)24 case of early-out)
25 * More efficient implementation for base64Binary items25 * More efficient implementation for base64Binary items
26 * Added index management function to the C++ api's StaticCollectionManager.26 * Added index management function to the C++ api's StaticCollectionManager.
27 * Fixed bug #945241 (StaticCollectionManager::declaredIndexes() and temporary indexes)
27 * Fixed bug #872288 (reset recursive flag during node rename)28 * Fixed bug #872288 (reset recursive flag during node rename)
28 * Fixed bug #905041 (allow for the default element and function namespaces to be29 * Fixed bug #905041 (allow for the default element and function namespaces to be
29 set multiple times via the c++ api).30 set multiple times via the c++ api).
3031
=== modified file 'src/runtime/collections/collections_impl.cpp'
--- src/runtime/collections/collections_impl.cpp 2012-02-16 12:48:17 +0000
+++ src/runtime/collections/collections_impl.cpp 2012-03-02 23:51:19 +0000
@@ -30,6 +30,7 @@
30#include "context/uri_resolver.h"30#include "context/uri_resolver.h"
31#include "context/static_context_consts.h"31#include "context/static_context_consts.h"
3232
33#include "compiler/xqddf/value_index.h"
33#include "compiler/xqddf/value_ic.h"34#include "compiler/xqddf/value_ic.h"
3435
35#include "runtime/collections/collections.h"36#include "runtime/collections/collections.h"
@@ -2331,20 +2332,21 @@
2331 PlanState& aPlanState) const2332 PlanState& aPlanState) const
2332{2333{
2333 store::Item_t lName;2334 store::Item_t lName;
2335 zorba::IndexDecl* lDecl;
23342336
2335 PlanIteratorState* lState;2337 PlanIteratorState* lState;
2336 DEFAULT_STACK_INIT(PlanIteratorState, lState, aPlanState);2338 DEFAULT_STACK_INIT(PlanIteratorState, lState, aPlanState);
23372339
2338 consumeNext(lName, theChildren[0].getp(), aPlanState);2340 consumeNext(lName, theChildren[0].getp(), aPlanState);
23392341
2340 if (theSctx->lookup_index(lName.getp()) == 0)2342 if ((lDecl = theSctx->lookup_index(lName.getp())) && !lDecl->isTemp())
2343 {
2344 STACK_PUSH(GENV_ITEMFACTORY->createBoolean(aResult, true), lState);
2345 }
2346 else
2341 {2347 {
2342 STACK_PUSH(GENV_ITEMFACTORY->createBoolean(aResult, false), lState);2348 STACK_PUSH(GENV_ITEMFACTORY->createBoolean(aResult, false), lState);
2343 }2349 }
2344 else
2345 {
2346 STACK_PUSH(GENV_ITEMFACTORY->createBoolean(aResult, true), lState);
2347 }
23482350
2349 STACK_END(lState);2351 STACK_END(lState);
2350}2352}
@@ -2386,6 +2388,10 @@
2386 for ((lState->nameItState = theSctx->index_names())->open();2388 for ((lState->nameItState = theSctx->index_names())->open();
2387 lState->nameItState->next(lName); )2389 lState->nameItState->next(lName); )
2388 {2390 {
2391 if (theSctx->lookup_index(lName.getp())->isTemp())
2392 {
2393 continue;
2394 }
2389 aResult = lName;2395 aResult = lName;
2390 STACK_PUSH(true, lState);2396 STACK_PUSH(true, lState);
2391 }2397 }
23922398
=== modified file 'test/unit/module1.xq'
--- test/unit/module1.xq 2011-08-05 02:21:55 +0000
+++ test/unit/module1.xq 2012-03-02 23:51:19 +0000
@@ -18,4 +18,4 @@
1818
19import module namespace ddl = "http://www.zorba-xquery.com/modules/store/static/collections/ddl";19import module namespace ddl = "http://www.zorba-xquery.com/modules/store/static/collections/ddl";
2020
211+121mod2:foo()
2222
=== modified file 'test/unit/module2.xq'
--- test/unit/module2.xq 2011-12-21 14:40:33 +0000
+++ test/unit/module2.xq 2012-03-02 23:51:19 +0000
@@ -27,3 +27,14 @@
27declare index mod2:index27declare index mod2:index
28 on nodes ddl:collection(xs:QName("mod2:coll"))28 on nodes ddl:collection(xs:QName("mod2:coll"))
29 by data(@id) as xs:string;29 by data(@id) as xs:string;
30
31
32(: test that a temp index doesn't have impact on the indexes
33 returned by the static collection mgr :)
34declare function mod2:foo()
35{
36 for $i in 1 to 10
37 for $j in 1 to 10
38 where $i eq $j
39 return $i
40};
3041
=== modified file 'test/unit/staticcollectionmanager.cpp'
--- test/unit/staticcollectionmanager.cpp 2012-01-11 17:30:25 +0000
+++ test/unit/staticcollectionmanager.cpp 2012-03-02 23:51:19 +0000
@@ -206,23 +206,26 @@
206 Item lCollName2 = lFac->createQName("http://www.mod2.com/", "coll");206 Item lCollName2 = lFac->createQName("http://www.mod2.com/", "coll");
207 207
208 lColMgr->createCollection(lCollName2);208 lColMgr->createCollection(lCollName2);
209 Collection_t lColl = lColMgr->getCollection(lCollName2);209
210210 {
211 std::vector<Annotation_t> lAnnotations;211 Collection_t lColl = lColMgr->getCollection(lCollName2);
212 lColl->getAnnotations(lAnnotations);212 std::vector<Annotation_t> lAnnotations;
213 size_t num_annotations = 0;213 lColl->getAnnotations(lAnnotations);
214 for (std::vector<Annotation_t>::const_iterator lIter = lAnnotations.begin();214 size_t num_annotations = 0;
215 lIter != lAnnotations.end(); ++lIter)215 for (std::vector<Annotation_t>::const_iterator lIter = lAnnotations.begin();
216 {216 lIter != lAnnotations.end(); ++lIter)
217 std::cout << "Annotation QName " << (*lIter)->getQName().getStringValue() << std::endl;217 {
218 ++num_annotations;218 std::cout << "Annotation QName " << (*lIter)->getQName().getStringValue() << std::endl;
219 }219 ++num_annotations;
220220 }
221 if (num_annotations != 3)221
222 {222 if (num_annotations != 3)
223 return false;223 {
224 }224 return false;
225225 }
226 }
227
228 lColMgr->deleteCollection(lCollName2);
226229
227 return true;230 return true;
228}231}
@@ -259,6 +262,44 @@
259 return i == 1;262 return i == 1;
260}263}
261264
265(: test that declaredIndexes doesn't return temporary indexes and crashes
266 : if one tries to create one :)
267bool
268staticcollectionamanger5(zorba::Zorba* z)
269{
270 std::ifstream lIn("module1.xq");
271
272 zorba::XQuery_t lQuery = z->createQuery();
273 Zorba_CompilerHints lHints;
274 lQuery->compile(lIn, lHints);
275
276 StaticCollectionManager* lColMgr = lQuery->getStaticCollectionManager();
277
278 ItemFactory* lFac = z->getItemFactory();
279 Item lCollName2 = lFac->createQName("http://www.mod2.com/", "coll");
280 Item lIdxName = lFac->createQName("http://www.mod2.com/", "index");
281 Item lCollName3 = lFac->createQName("http://www.mod3.com/", "coll");
282
283 ItemSequence_t lSeq = lColMgr->declaredCollections();
284 Iterator_t lIter = lSeq->getIterator();
285 lIter->open();
286 Item lTmp;
287 while (lIter->next(lTmp)) {
288 std::cout << "name " << lTmp.getStringValue() << std::endl;
289 lColMgr->createCollection(lTmp);
290 }
291
292 lSeq = lColMgr->declaredIndexes();
293 lIter = lSeq->getIterator();
294 lIter->open();
295 while (lIter->next(lTmp)) {
296 std::cout << "name " << lTmp.getStringValue() << std::endl;
297 lColMgr->createIndex(lTmp);
298 }
299
300 return true;
301}
302
262int303int
263staticcollectionmanager(int argc, char* argv[])304staticcollectionmanager(int argc, char* argv[])
264{305{
@@ -287,6 +328,11 @@
287 return 4;328 return 4;
288 std::cout << std::endl;329 std::cout << std::endl;
289330
331 std::cout << "executing example 5" << std::endl;
332 if (!staticcollectionamanger5(z))
333 return 5;
334 std::cout << std::endl;
335
290 return 0;336 return 0;
291}337}
292338

Subscribers

People subscribed via source and target branches