memgraph/tests/integration/hardcoded_query/create_garment_conceals.cpp
Mislav Bradac 67b859cf13 Add AST cache
Reviewers: buda, teon.banek, florijan

Reviewed By: buda

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D468
2017-06-14 18:59:31 +02:00

40 lines
1.2 KiB
C++

#include <iostream>
#include <string>
#include "query/parameters.hpp"
#include "query/plan_interface.hpp"
#include "query/typed_value.hpp"
#include "storage/edge_accessor.hpp"
#include "storage/vertex_accessor.hpp"
#include "using.hpp"
using std::cout;
using std::endl;
using query::TypedValue;
// 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 Parameters &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).second);
v.PropsSet(db_accessor.property("garment_category_id"), args.At(1).second);
v.PropsSet(db_accessor.property("conceals"), args.At(2).second);
std::vector<std::string> headers{std::string("g")};
stream.Header(headers);
std::vector<TypedValue> result{TypedValue(v)};
stream.Result(result);
return true;
}
~CPUPlan() {}
};
extern "C" PlanInterface<Stream> *produce() { return new CPUPlan(); }
extern "C" void destruct(PlanInterface<Stream> *p) { delete p; }