MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / FindOrAddAttribute

Function FindOrAddAttribute

src/graph/graph_hub.c:461–483  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

459}
460
461Attribute_ID FindOrAddAttribute
462(
463 GraphContext *gc, // graph context to add the attribute
464 const char *attribute, // attribute name
465 bool log // should operation be logged in the undo-log
466) {
467 ASSERT(gc != NULL);
468 ASSERT(attribute != NULL);
469
470 bool created;
471 Attribute_ID attr_id = GraphContext_FindOrAddAttribute(gc, attribute,
472 &created);
473
474 // in case there was an append, the latest id should be tracked
475 if(created == true && log == true) {
476 UndoLog undo_log = QueryCtx_GetUndoLog();
477 UndoLog_AddAttribute(undo_log, attr_id);
478 EffectsBuffer *eb = QueryCtx_GetEffectsBuffer();
479 EffectsBuffer_AddNewAttributeEffect(eb, attribute);
480 }
481
482 return attr_id;
483}
484

Callers 4

_Constraint_CreateFunction · 0.85
ApplyAddAttributeFunction · 0.85
EvalEntityUpdatesFunction · 0.85
ConvertPropertyMapFunction · 0.85

Calls 5

QueryCtx_GetUndoLogFunction · 0.85
UndoLog_AddAttributeFunction · 0.85

Tested by

no test coverage detected