1Patch provided by Lauren Foutz. See:
2https://community.oracle.com/thread/4093422
3
4--- dbxml-6.1.4-orig/dbxml/src/dbxml/query/ParentOfChildJoinQP.cpp
5+++ dbxml-6.1.4/dbxml/src/dbxml/query/ParentOfChildJoinQP.cpp
6@@ -139,28 +139,16 @@ bool ParentOfChildIterator::doJoin(Dynam
7
8 // Invarient 4: When ancestorStack_ is empty we can output the
9 // buffered results_, since any more results will come after them in
10 // document order.
11
12 while(true) {
13 context->testInterrupt();
14
15- /*
16- * If current parent's node level already be larger than
17- * childen's, abandon current parent and move to next one.
18- */
19- if (parents_ != NULL &&
20- parents_->getNodeLevel() > children_->getNodeLevel()) {
21- if(!parents_->next(context)) {
22- delete parents_;
23- parents_ = 0;
24- }
25- }
26-
27 int cmp = parents_ == 0 ? -1 : isDescendantOf(children_, parents_, /*orSelf*/false);
28 if(cmp < 0) {
29 if(!ancestorStack_.empty()) {
30 // We've found the closest ancestor - is it a parent?
31 if(ancestorStack_.back()->getNodeLevel() == (children_->getNodeLevel() - 1)) {
32 // Maintain invarient 3
33 if(results_.empty() || NodeInfo::compare(results_.back(), ancestorStack_.back()) < 0)
34 results_.push_back(ancestorStack_.back());