match vertex by id, label and from main vertex store

This commit is contained in:
Marko Budiselic 2016-08-30 06:26:27 +01:00
parent 0f7be340fa
commit b5db8d8d1e
5 changed files with 15 additions and 8 deletions

View File

@ -38,6 +38,7 @@ auto return_query_action =
code += code_line(code::write_all_edges, entity); code += code_line(code::write_all_edges, entity);
} }
// the client will receive entities from label index
if (cypher_data.source(entity) == EntitySource::LabelIndex) if (cypher_data.source(entity) == EntitySource::LabelIndex)
{ {
if (cypher_data.type(entity) == EntityType::Node) { if (cypher_data.type(entity) == EntityType::Node) {
@ -47,7 +48,6 @@ auto return_query_action =
code += code_line(code::fine_and_write_vertices_by_label, code += code_line(code::fine_and_write_vertices_by_label,
entity, label); entity, label);
} }
// TODO: code_line
} }
} }
else if (element.is_projection()) else if (element.is_projection())

View File

@ -36,7 +36,8 @@ public:
} catch (QueryEngineException &e) { } catch (QueryEngineException &e) {
// in this case something fatal went wrong // in this case something fatal went wrong
logger.error("QueryEngineException: {}", std::string(e.what())); logger.error("QueryEngineException: {}", std::string(e.what()));
return false; // return false;
throw e;
} }
} }

View File

@ -74,12 +74,12 @@ const std::string write_all_vertices =
const std::string fine_and_write_vertices_by_label = const std::string fine_and_write_vertices_by_label =
"auto &label = t.label_find_or_create(\"{1}\");\n" "auto &label = t.label_find_or_create(\"{1}\");\n"
" stream.write_field(\"{0}\");\n" " stream.write_field(\"{0}\");\n"
" label.index().for_range(t).for_all([&](auto vertex) {\n" " label.index().for_range(t)->for_all([&](auto vertex) {{\n"
" stream.write_record();\n" " stream.write_record();\n"
" stream.write_list_header(1);\n" " stream.write_list_header(1);\n"
" stream.write(vertex);\n" " stream.write(vertex);\n"
" stream.chunk();\n" " stream.chunk();\n"
" });\n" " }});\n"
" stream.write_meta(\"rw\");\n"; " stream.write_meta(\"rw\");\n";
const std::string write_all_edges = const std::string write_all_edges =

View File

@ -3,12 +3,12 @@
#include <string> #include <string>
#include "cypher/visitor/traverser.hpp" #include "cypher/visitor/traverser.hpp"
#include "query_engine/code_generator/cpp_generator.hpp" #include "query_engine/code_generator/cpp_generator.hpp"
#include "query_engine/code_generator/entity_search.hpp" #include "query_engine/code_generator/entity_search.hpp"
#include "query_engine/code_generator/structures.hpp" #include "query_engine/code_generator/structures.hpp"
#include "query_engine/exceptions/exceptions.hpp" #include "query_engine/exceptions/exceptions.hpp"
#include "query_engine/traverser/code.hpp" #include "query_engine/traverser/code.hpp"
#include "logging/default.hpp"
struct SetElementState struct SetElementState
{ {
@ -99,7 +99,11 @@ private:
generator.clear(); generator.clear();
} }
Logger logger;
public: public:
CppTraverser() : logger(logging::log->logger("CppTraverser")) {}
void semantic_check() const void semantic_check() const
{ {
if (!has_return) if (!has_return)

View File

@ -61,9 +61,11 @@ void Executor::run(Session& session, Query& query)
auto &db = session.active_db(); auto &db = session.active_db();
logger.debug("[ActiveDB] '{}'", db.name()); logger.debug("[ActiveDB] '{}'", db.name());
// TODO: error handling try {
query_engine.execute(query.statement, db, session.output_stream); query_engine.execute(query.statement, db, session.output_stream);
} catch (QueryEngineException &e) {
// return error to user
}
} }
void Executor::pull_all(Session& session) void Executor::pull_all(Session& session)