2016-11-29 21:08:29 +08:00
|
|
|
#include <iostream>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include "query/util.hpp"
|
2017-02-14 16:37:32 +08:00
|
|
|
#include "query/plan_interface.hpp"
|
2016-11-29 21:08:29 +08:00
|
|
|
#include "storage/model/properties/all.hpp"
|
|
|
|
#include "using.hpp"
|
|
|
|
|
|
|
|
using std::cout;
|
|
|
|
using std::endl;
|
|
|
|
|
|
|
|
// Query: MATCH (n) DETACH DELETE n
|
|
|
|
|
2017-02-14 16:37:32 +08:00
|
|
|
class CPUPlan : public PlanInterface<Stream>
|
2016-11-29 21:08:29 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2017-02-14 16:37:32 +08:00
|
|
|
bool run(Db &db, const PlanArgsT &args, Stream &stream) override
|
2016-11-29 21:08:29 +08:00
|
|
|
{
|
|
|
|
DbAccessor t(db);
|
|
|
|
|
|
|
|
t.edge_access().fill().for_all([&](auto e) { e.remove(); });
|
|
|
|
t.vertex_access().fill().isolated().for_all(
|
|
|
|
[&](auto a) { a.remove(); });
|
|
|
|
|
|
|
|
stream.write_empty_fields();
|
|
|
|
stream.write_meta("w");
|
|
|
|
|
|
|
|
return t.commit();
|
|
|
|
}
|
|
|
|
|
2017-02-14 16:37:32 +08:00
|
|
|
~CPUPlan() {}
|
2016-11-29 21:08:29 +08:00
|
|
|
};
|
|
|
|
|
2017-02-14 16:37:32 +08:00
|
|
|
extern "C" PlanInterface<Stream>* produce()
|
2016-11-29 21:08:29 +08:00
|
|
|
{
|
2017-02-14 16:37:32 +08:00
|
|
|
return new CPUPlan();
|
2016-11-29 21:08:29 +08:00
|
|
|
}
|
|
|
|
|
2017-02-14 16:37:32 +08:00
|
|
|
extern "C" void destruct(PlanInterface<Stream>* p)
|
2016-11-29 21:08:29 +08:00
|
|
|
{
|
|
|
|
delete p;
|
|
|
|
}
|