2016-01-27 06:40:11 +08:00
|
|
|
#pragma once
|
|
|
|
|
2016-02-22 05:21:15 +08:00
|
|
|
#include "program_loader.hpp"
|
|
|
|
#include "program_executor.hpp"
|
2016-01-27 06:40:11 +08:00
|
|
|
#include "query_result.hpp"
|
|
|
|
|
|
|
|
//
|
|
|
|
// Current arhitecture:
|
2016-02-07 03:48:40 +08:00
|
|
|
// query -> code_loader -> query_stripper -> [code_generator]
|
|
|
|
// -> [code_compiler] -> code_executor
|
2016-01-27 06:40:11 +08:00
|
|
|
|
|
|
|
class QueryEngine
|
|
|
|
{
|
|
|
|
public:
|
2016-02-04 09:45:12 +08:00
|
|
|
|
2016-02-22 05:21:15 +08:00
|
|
|
auto execute(const std::string& query)
|
2016-01-27 06:40:11 +08:00
|
|
|
{
|
2016-02-22 05:21:15 +08:00
|
|
|
auto program = program_loader.load(query);
|
|
|
|
auto result = program_executor.execute(program);
|
|
|
|
return result;
|
2016-01-27 06:40:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2016-02-22 05:21:15 +08:00
|
|
|
ProgramExecutor program_executor;
|
|
|
|
ProgramLoader program_loader;
|
2016-01-27 06:40:11 +08:00
|
|
|
};
|