fix bug on API when using accessor marked with for_deleted_ž
This commit is contained in:
@@ -94,6 +94,10 @@ class EdgeAccessor final {
|
|||||||
|
|
||||||
VertexAccessor From() const;
|
VertexAccessor From() const;
|
||||||
|
|
||||||
|
VertexAccessor ToWithDeleted() const;
|
||||||
|
|
||||||
|
VertexAccessor FromWithDeleted() const;
|
||||||
|
|
||||||
bool IsCycle() const;
|
bool IsCycle() const;
|
||||||
|
|
||||||
int64_t CypherId() const { return impl_.Gid().AsInt(); }
|
int64_t CypherId() const { return impl_.Gid().AsInt(); }
|
||||||
@@ -206,6 +210,10 @@ inline VertexAccessor EdgeAccessor::To() const { return VertexAccessor(impl_.ToV
|
|||||||
|
|
||||||
inline VertexAccessor EdgeAccessor::From() const { return VertexAccessor(impl_.FromVertex()); }
|
inline VertexAccessor EdgeAccessor::From() const { return VertexAccessor(impl_.FromVertex()); }
|
||||||
|
|
||||||
|
inline VertexAccessor EdgeAccessor::ToWithDeleted() const { return VertexAccessor(impl_.ToVertexWithDeleted()); }
|
||||||
|
|
||||||
|
inline VertexAccessor EdgeAccessor::FromWithDeleted() const { return VertexAccessor(impl_.FromVertexWithDeleted()); }
|
||||||
|
|
||||||
inline bool EdgeAccessor::IsCycle() const { return To() == From(); }
|
inline bool EdgeAccessor::IsCycle() const { return To() == From(); }
|
||||||
|
|
||||||
class SubgraphVertexAccessor final {
|
class SubgraphVertexAccessor final {
|
||||||
|
|||||||
@@ -487,12 +487,15 @@ mgp_value::mgp_value(const memgraph::query::TypedValue &tv, mgp_graph *graph, me
|
|||||||
edge_v = std::visit(
|
edge_v = std::visit(
|
||||||
memgraph::utils::Overloaded{
|
memgraph::utils::Overloaded{
|
||||||
[&tv, graph, &allocator](memgraph::query::DbAccessor *) {
|
[&tv, graph, &allocator](memgraph::query::DbAccessor *) {
|
||||||
return allocator.new_object<mgp_edge>(tv.ValueEdge(), graph);
|
return allocator.new_object<mgp_edge>(tv.ValueEdge(), tv.ValueEdge().FromWithDeleted(),
|
||||||
|
tv.ValueEdge().ToWithDeleted(), graph);
|
||||||
},
|
},
|
||||||
[&tv, graph, &allocator](memgraph::query::SubgraphDbAccessor *db_impl) {
|
[&tv, graph, &allocator](memgraph::query::SubgraphDbAccessor *db_impl) {
|
||||||
return allocator.new_object<mgp_edge>(
|
return allocator.new_object<mgp_edge>(
|
||||||
tv.ValueEdge(), memgraph::query::SubgraphVertexAccessor(tv.ValueEdge().From(), db_impl->getGraph()),
|
tv.ValueEdge(),
|
||||||
memgraph::query::SubgraphVertexAccessor(tv.ValueEdge().To(), db_impl->getGraph()), graph);
|
memgraph::query::SubgraphVertexAccessor(tv.ValueEdge().FromWithDeleted(), db_impl->getGraph()),
|
||||||
|
memgraph::query::SubgraphVertexAccessor(tv.ValueEdge().ToWithDeleted(), db_impl->getGraph()),
|
||||||
|
graph);
|
||||||
}},
|
}},
|
||||||
graph->impl);
|
graph->impl);
|
||||||
break;
|
break;
|
||||||
@@ -847,15 +850,19 @@ mgp_value::mgp_value(mgp_value &&other, memgraph::utils::MemoryResource *m) : ty
|
|||||||
mgp_value::~mgp_value() noexcept { DeleteValueMember(this); }
|
mgp_value::~mgp_value() noexcept { DeleteValueMember(this); }
|
||||||
|
|
||||||
mgp_edge *mgp_edge::Copy(const mgp_edge &edge, mgp_memory &memory) {
|
mgp_edge *mgp_edge::Copy(const mgp_edge &edge, mgp_memory &memory) {
|
||||||
return std::visit(
|
return std::visit(memgraph::utils::Overloaded{
|
||||||
memgraph::utils::Overloaded{
|
[&](memgraph::query::DbAccessor *) {
|
||||||
[&](memgraph::query::DbAccessor *) { return NewRawMgpObject<mgp_edge>(&memory, edge.impl, edge.from.graph); },
|
return NewRawMgpObject<mgp_edge>(&memory, edge.impl, edge.impl.FromWithDeleted(),
|
||||||
[&](memgraph::query::SubgraphDbAccessor *db_impl) {
|
edge.impl.ToWithDeleted(), edge.from.graph);
|
||||||
return NewRawMgpObject<mgp_edge>(
|
},
|
||||||
&memory, edge.impl, memgraph::query::SubgraphVertexAccessor(edge.impl.From(), db_impl->getGraph()),
|
[&](memgraph::query::SubgraphDbAccessor *db_impl) {
|
||||||
memgraph::query::SubgraphVertexAccessor(edge.impl.To(), db_impl->getGraph()), edge.to.graph);
|
return NewRawMgpObject<mgp_edge>(
|
||||||
}},
|
&memory, edge.impl,
|
||||||
edge.to.graph->impl);
|
memgraph::query::SubgraphVertexAccessor(edge.impl.FromWithDeleted(), db_impl->getGraph()),
|
||||||
|
memgraph::query::SubgraphVertexAccessor(edge.impl.ToWithDeleted(), db_impl->getGraph()),
|
||||||
|
edge.to.graph);
|
||||||
|
}},
|
||||||
|
edge.to.graph->impl);
|
||||||
}
|
}
|
||||||
|
|
||||||
mgp_error mgp_value_copy(mgp_value *val, mgp_memory *memory, mgp_value **result) {
|
mgp_error mgp_value_copy(mgp_value *val, mgp_memory *memory, mgp_value **result) {
|
||||||
|
|||||||
@@ -105,6 +105,15 @@ VertexAccessor EdgeAccessor::ToVertex() const {
|
|||||||
return VertexAccessor{to_vertex_, transaction_, indices_, constraints_, config_};
|
return VertexAccessor{to_vertex_, transaction_, indices_, constraints_, config_};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VertexAccessor EdgeAccessor::FromVertexWithDeleted() const {
|
||||||
|
return VertexAccessor{from_vertex_, transaction_, indices_,
|
||||||
|
constraints_, config_, for_deleted_ && from_vertex_->deleted};
|
||||||
|
}
|
||||||
|
|
||||||
|
VertexAccessor EdgeAccessor::ToVertexWithDeleted() const {
|
||||||
|
return VertexAccessor{to_vertex_, transaction_, indices_, constraints_, config_, for_deleted_ && to_vertex_->deleted};
|
||||||
|
}
|
||||||
|
|
||||||
Result<storage::PropertyValue> EdgeAccessor::SetProperty(PropertyId property, const PropertyValue &value) {
|
Result<storage::PropertyValue> EdgeAccessor::SetProperty(PropertyId property, const PropertyValue &value) {
|
||||||
utils::MemoryTracker::OutOfMemoryExceptionEnabler oom_exception;
|
utils::MemoryTracker::OutOfMemoryExceptionEnabler oom_exception;
|
||||||
if (!config_.properties_on_edges) return Error::PROPERTIES_DISABLED;
|
if (!config_.properties_on_edges) return Error::PROPERTIES_DISABLED;
|
||||||
|
|||||||
@@ -52,6 +52,10 @@ class EdgeAccessor final {
|
|||||||
|
|
||||||
VertexAccessor ToVertex() const;
|
VertexAccessor ToVertex() const;
|
||||||
|
|
||||||
|
VertexAccessor FromVertexWithDeleted() const;
|
||||||
|
|
||||||
|
VertexAccessor ToVertexWithDeleted() const;
|
||||||
|
|
||||||
EdgeTypeId EdgeType() const { return edge_type_; }
|
EdgeTypeId EdgeType() const { return edge_type_; }
|
||||||
|
|
||||||
/// Set a property value and return the old value.
|
/// Set a property value and return the old value.
|
||||||
|
|||||||
Reference in New Issue
Block a user