1
0
Fork 0

Merge branch 'aql2' of ssh://github.com/triAGENS/ArangoDB into aql2

Conflicts:
	arangod/Aql/Query.cpp
This commit is contained in:
Max Neunhoeffer 2014-08-01 12:05:37 +02:00
commit aa48d48755
2 changed files with 18 additions and 10 deletions

View File

@ -96,7 +96,13 @@ struct Instanciator : public ExecutionNode::WalkerWorker {
THROW_ARANGO_EXCEPTION(TRI_ERROR_NOT_IMPLEMENTED);
}
}
engine->addBlock(eb);
try {
engine->addBlock(eb);
}
catch (...) {
delete eb;
throw;
}
// Now add dependencies:
std::vector<ExecutionNode*> deps = en->getDependencies();
@ -128,7 +134,11 @@ ExecutionEngine* ExecutionEngine::instanciateFromPlan (ExecutionNode* plan) {
auto root = inst->root;
delete inst;
root->staticAnalysis();
root->initialize();
engine->_root = root;
}
catch (...) {
delete engine;

View File

@ -29,6 +29,7 @@
#include "Aql/Query.h"
#include "Aql/ExecutionBlock.h"
#include "Aql/ExecutionEngine.h"
#include "Aql/ExecutionPlan.h"
#include "Aql/Parser.h"
#include "Aql/V8Executor.h"
@ -176,25 +177,22 @@ QueryResult Query::execute () {
auto plan = ExecutionPlan::instanciateFromAst(parser.ast());
try {
auto exec = ExecutionEngine::instanciateFromPlan(plan);
auto engine = ExecutionEngine::instanciateFromPlan(plan->root());
try {
exec->root()->staticAnalysis();
exec->root()->initialize();
exec->root()->execute();
auto root = engine->root();
root->execute();
AqlItemBlock* value;
while (nullptr != (value = exec->root()->getOne())) {
while (nullptr != (value = root->getOne())) {
std::cout << value->getValue(0, 0)->toString() << std::endl;
delete value;
}
exec->root()->shutdown();
delete exec;
delete engine;
}
catch (...) {
delete exec;
delete engine;
delete plan;
// TODO: convert exception code
return QueryResult(TRI_ERROR_INTERNAL);