1
0
Fork 0

Take care of empty lists to loop over.

This commit is contained in:
Max Neunhoeffer 2014-08-11 13:15:13 +02:00
parent 3b1d938dda
commit b6564690ee
2 changed files with 91 additions and 71 deletions

View File

@ -114,6 +114,12 @@ void ExecutionBlock::staticAnalysis (ExecutionBlock* super) {
sq->getSubquery()->staticAnalysis(s);
}
v->reset();
// Now print the result:
for (auto it : _varOverview->varInfo) {
std::cout << "Variable ID:" << it.first << " RegisterId:"
<< it.second.registerId << " Depth:" << it.second.depth
<< std::endl;
}
}
// Local Variables:

View File

@ -1127,6 +1127,14 @@ namespace triagens {
return nullptr;
}
AqlItemBlock* res;
do {
// repeatedly try to get more stuff from upstream
// note that the value of the variable we have to loop over
// can contain zero entries, in which case we have to
// try again!
if (_buffer.empty()) {
if (! ExecutionBlock::getBlock(DefaultBatchSize, DefaultBatchSize)) {
_done = true;
@ -1173,10 +1181,14 @@ namespace triagens {
}
}
if (sizeInVar == 0) {
res = nullptr;
}
else {
size_t toSend = std::min(atMost, sizeInVar - _index);
//create the result
auto res = new AqlItemBlock(toSend, _varOverview->nrRegs[_depth]);
res = new AqlItemBlock(toSend, _varOverview->nrRegs[_depth]);
inheritRegisters(cur, res, _pos);
@ -1196,6 +1208,7 @@ namespace triagens {
// requirements
// Note that _index has been increased by 1 by getAqlValue!
}
}
if (_index == sizeInVar) {
_index = 0;
_thisblock = 0;
@ -1207,6 +1220,7 @@ namespace triagens {
_pos = 0;
}
}
} while (res == nullptr);
return res;
}