8220808f56
Summary: Add vertex stream operator. Implement #0, #1 query. Support first batch of queries for testDB. Improve record stream handler. Query engine now supports multiline queries patterns in file comments. Second and third batch of tests complete. Add functionality to print_record_stream. Include 4th batch. Crete a shared function for properties output. Reviewers: buda Reviewed By: buda Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D60
36 lines
1.0 KiB
C++
36 lines
1.0 KiB
C++
#include <iostream>
|
|
#include <string>
|
|
|
|
#include "query/plan_interface.hpp"
|
|
#include "storage/edge_accessor.hpp"
|
|
#include "storage/vertex_accessor.hpp"
|
|
#include "using.hpp"
|
|
|
|
using std::cout;
|
|
using std::endl;
|
|
|
|
// Query: CREATE (g:garment {garment_id: 1234, garment_category_id:
|
|
// 1,conceals:30}) RETURN g
|
|
|
|
class CPUPlan : public PlanInterface<Stream> {
|
|
public:
|
|
bool run(GraphDbAccessor &db_accessor, const TypedValueStore<> &args,
|
|
Stream &stream) {
|
|
auto v = db_accessor.insert_vertex();
|
|
v.add_label(db_accessor.label("garment"));
|
|
v.PropsSet(db_accessor.property("garment_id"), args.at(0));
|
|
v.PropsSet(db_accessor.property("garment_category_id"), args.at(1));
|
|
v.PropsSet(db_accessor.property("conceals"), args.at(2));
|
|
stream.write_field("g");
|
|
stream.write_vertex_record(v);
|
|
stream.write_meta("rw");
|
|
return db_accessor.transaction_.commit();
|
|
}
|
|
|
|
~CPUPlan() {}
|
|
};
|
|
|
|
extern "C" PlanInterface<Stream> *produce() { return new CPUPlan(); }
|
|
|
|
extern "C" void destruct(PlanInterface<Stream> *p) { delete p; }
|