2017-11-23 21:26:53 +08:00
|
|
|
#include "communication/result_stream_faker.hpp"
|
2018-10-05 18:37:23 +08:00
|
|
|
#include "database/single_node/graph_db.hpp"
|
|
|
|
#include "database/single_node/graph_db_accessor.hpp"
|
2017-11-23 21:26:53 +08:00
|
|
|
#include "query/interpreter.hpp"
|
|
|
|
|
|
|
|
int main(int argc, char *argv[]) {
|
|
|
|
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
|
|
|
|
|
|
|
// parse the first cmd line argument as the query
|
|
|
|
if (argc < 2) {
|
|
|
|
std::cout << "Usage: ./single_query 'RETURN \"query here\"'" << std::endl;
|
|
|
|
exit(1);
|
|
|
|
}
|
2019-10-10 17:23:33 +08:00
|
|
|
|
2018-10-09 17:09:10 +08:00
|
|
|
database::GraphDb db;
|
2019-10-10 17:23:33 +08:00
|
|
|
query::InterpreterContext interpreter_context{&db};
|
|
|
|
query::Interpreter interpreter{&interpreter_context};
|
|
|
|
|
2019-10-28 21:07:31 +08:00
|
|
|
ResultStreamFaker stream;
|
2019-10-18 22:27:47 +08:00
|
|
|
auto [header, _] = interpreter.Prepare(argv[1], {});
|
2019-10-10 17:23:33 +08:00
|
|
|
stream.Header(header);
|
|
|
|
auto summary = interpreter.PullAll(&stream);
|
|
|
|
stream.Summary(summary);
|
2018-07-20 18:31:22 +08:00
|
|
|
std::cout << stream;
|
2019-10-10 17:23:33 +08:00
|
|
|
|
2017-11-23 21:26:53 +08:00
|
|
|
return 0;
|
|
|
|
}
|