ccdffa1d7e
Summary: Rename TypedValue to PropertyValue. Move original TypedValue to query/backend/cpp. Fix undefined behaviours and memory leaks in PropertyValue. Add list type to PropertyValue. Operators and appropriate tests will be revised in following commits. Fix bugs in TypedValue Fix bugs in typed value Reviewers: buda, florijan Reviewed By: buda Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D77
35 lines
985 B
C++
35 lines
985 B
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}) RETURN g
|
|
|
|
class CPUPlan : public PlanInterface<Stream> {
|
|
public:
|
|
bool run(GraphDbAccessor &db_accessor, const PropertyValueStore<> &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));
|
|
stream.write_field("g");
|
|
stream.write_vertex_record(v);
|
|
stream.write_meta("rw");
|
|
db_accessor.transaction_.commit();
|
|
return true;
|
|
}
|
|
|
|
~CPUPlan() {}
|
|
};
|
|
|
|
extern "C" PlanInterface<Stream> *produce() { return new CPUPlan(); }
|
|
|
|
extern "C" void destruct(PlanInterface<Stream> *p) { delete p; }
|