add a edge creation effect to buffer
| 372 | |
| 373 | // add a edge creation effect to buffer |
| 374 | void EffectsBuffer_AddCreateEdgeEffect |
| 375 | ( |
| 376 | EffectsBuffer *buff, // effect buffer |
| 377 | const Edge *edge // edge created |
| 378 | ) { |
| 379 | //-------------------------------------------------------------------------- |
| 380 | // effect format: |
| 381 | // effect type |
| 382 | // relationship count |
| 383 | // relationships |
| 384 | // src node ID |
| 385 | // dest node ID |
| 386 | // attribute count |
| 387 | // attributes (id,value) pair |
| 388 | //-------------------------------------------------------------------------- |
| 389 | |
| 390 | ResultSetStatistics *stats = QueryCtx_GetResultSetStatistics(); |
| 391 | stats->relationships_created++; |
| 392 | stats->properties_set += AttributeSet_Count(*edge->attributes); |
| 393 | |
| 394 | EffectType t = EFFECT_CREATE_EDGE; |
| 395 | EffectsBuffer_WriteBytes(&t, sizeof(t), buff); |
| 396 | |
| 397 | //-------------------------------------------------------------------------- |
| 398 | // write relationship type |
| 399 | //-------------------------------------------------------------------------- |
| 400 | |
| 401 | ushort rel_count = 1; |
| 402 | EffectsBuffer_WriteBytes(&rel_count, sizeof(rel_count), buff); |
| 403 | |
| 404 | RelationID rel_id = Edge_GetRelationID(edge); |
| 405 | EffectsBuffer_WriteBytes(&rel_id, sizeof(RelationID), buff); |
| 406 | |
| 407 | //-------------------------------------------------------------------------- |
| 408 | // write src node ID |
| 409 | //-------------------------------------------------------------------------- |
| 410 | |
| 411 | NodeID src_id = Edge_GetSrcNodeID(edge); |
| 412 | EffectsBuffer_WriteBytes(&src_id, sizeof(NodeID), buff); |
| 413 | |
| 414 | //-------------------------------------------------------------------------- |
| 415 | // write dest node ID |
| 416 | //-------------------------------------------------------------------------- |
| 417 | |
| 418 | NodeID dest_id = Edge_GetDestNodeID(edge); |
| 419 | EffectsBuffer_WriteBytes(&dest_id, sizeof(NodeID), buff); |
| 420 | |
| 421 | //-------------------------------------------------------------------------- |
| 422 | // write attribute set |
| 423 | //-------------------------------------------------------------------------- |
| 424 | |
| 425 | const AttributeSet attrs = GraphEntity_GetAttributes((GraphEntity*)edge); |
| 426 | EffectsBuffer_WriteAttributeSet(attrs, buff); |
| 427 | |
| 428 | EffectsBuffer_IncEffectCount(buff); |
| 429 | } |
| 430 | |
| 431 | // add a node deletion effect to buffer |
no test coverage detected