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

View File

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