2016-01-27 06:40:11 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
#include "query_traverser.hpp"
|
|
|
|
#include "code_generator.hpp"
|
|
|
|
#include "code_compiler.hpp"
|
|
|
|
#include "query_executor.hpp"
|
|
|
|
#include "query_result.hpp"
|
|
|
|
|
|
|
|
using std::cout;
|
|
|
|
using std::endl;
|
|
|
|
|
|
|
|
//
|
|
|
|
// Current arhitecture:
|
|
|
|
// query -> traverser -> [generator] -> [compiler] -> executor
|
|
|
|
//
|
|
|
|
|
|
|
|
class QueryEngine
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
QueryResult execute(const std::string& query)
|
|
|
|
{
|
2016-01-28 07:29:38 +08:00
|
|
|
traverser.build_tree(query);
|
|
|
|
traverser.traverse();
|
2016-01-27 06:40:11 +08:00
|
|
|
return QueryResult();
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2016-01-28 07:29:38 +08:00
|
|
|
// TODO: use IoC or something similar
|
2016-01-27 06:40:11 +08:00
|
|
|
QueryTraverser traverser;
|
|
|
|
CodeGenerator generator;
|
|
|
|
CodeCompiler compiler;
|
|
|
|
QueryExecutor executor;
|
|
|
|
};
|