2016-07-11 09:39:33 +08:00
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
#define DEBUG 1
|
|
|
|
|
|
|
|
#include "utils/command_line/arguments.hpp"
|
|
|
|
#include "cypher/common.hpp"
|
|
|
|
#include "query_engine/query_engine.hpp"
|
|
|
|
#include "utils/time/timer.hpp"
|
2016-07-18 01:32:35 +08:00
|
|
|
#include "utils/terminate_handler.hpp"
|
2016-08-11 11:47:30 +08:00
|
|
|
#include "communication/communication.hpp"
|
2016-07-11 09:39:33 +08:00
|
|
|
|
|
|
|
using std::cout;
|
|
|
|
using std::endl;
|
|
|
|
using std::cin;
|
|
|
|
|
|
|
|
int main(void)
|
|
|
|
{
|
2016-07-18 01:32:35 +08:00
|
|
|
std::set_terminate(&terminate_handler);
|
|
|
|
|
2016-08-10 16:39:02 +08:00
|
|
|
Db db;
|
2016-07-11 09:39:33 +08:00
|
|
|
QueryEngine engine;
|
2016-08-11 11:47:30 +08:00
|
|
|
// TODO: write dummy socket that is going to execute test
|
|
|
|
io::Socket socket;
|
|
|
|
communication::OutputStream stream(socket);
|
2016-07-11 09:39:33 +08:00
|
|
|
|
|
|
|
cout << "-- Memgraph query engine --" << endl;
|
2016-07-18 01:32:35 +08:00
|
|
|
|
|
|
|
while (true) {
|
|
|
|
// read command
|
2016-07-11 09:39:33 +08:00
|
|
|
cout << "> ";
|
2016-07-18 01:32:35 +08:00
|
|
|
std::string command;
|
2016-07-11 09:39:33 +08:00
|
|
|
std::getline(cin, command);
|
2016-07-18 01:32:35 +08:00
|
|
|
if (command == "quit")
|
|
|
|
break;
|
|
|
|
|
|
|
|
// execute command
|
|
|
|
try {
|
2016-08-11 11:47:30 +08:00
|
|
|
engine.execute(command, db, stream);
|
2016-07-18 01:32:35 +08:00
|
|
|
} catch (const std::exception& e) {
|
|
|
|
cout << e.what() << endl;
|
|
|
|
} catch (const QueryEngineException& e) {
|
|
|
|
cout << e.what() << endl;
|
|
|
|
}
|
|
|
|
}
|
2016-07-11 09:39:33 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|