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);
|
|
|
|
}
|
2018-10-09 17:09:10 +08:00
|
|
|
database::GraphDb db;
|
2018-07-26 15:08:21 +08:00
|
|
|
auto dba = db.Access();
|
2019-09-11 22:10:53 +08:00
|
|
|
query::DbAccessor query_dba(&dba);
|
2018-07-20 18:31:22 +08:00
|
|
|
ResultStreamFaker<query::TypedValue> stream;
|
2019-10-23 21:12:12 +08:00
|
|
|
query::InterpreterContext interpreter_context;
|
2019-10-07 23:31:25 +08:00
|
|
|
auto results = query::Interpreter(&interpreter_context)(
|
|
|
|
argv[1], &query_dba, {}, false, utils::NewDeleteResource());
|
2018-07-20 18:31:22 +08:00
|
|
|
stream.Header(results.header());
|
|
|
|
results.PullAll(stream);
|
|
|
|
stream.Summary(results.summary());
|
|
|
|
std::cout << stream;
|
2017-11-23 21:26:53 +08:00
|
|
|
return 0;
|
|
|
|
}
|