prepare to create all nodes for the current Record
| 47 | |
| 48 | // prepare to create all nodes for the current Record |
| 49 | static void _CreateNodes |
| 50 | ( |
| 51 | OpCreate *op, |
| 52 | Record r, |
| 53 | GraphContext *gc |
| 54 | ) { |
| 55 | uint nodes_to_create_count = array_len(op->pending.nodes_to_create); |
| 56 | for(uint i = 0; i < nodes_to_create_count; i++) { |
| 57 | // get specified node to create |
| 58 | NodeCreateCtx *n = op->pending.nodes_to_create + i; |
| 59 | |
| 60 | // create a new node |
| 61 | Node newNode = Graph_ReserveNode(gc->g); |
| 62 | |
| 63 | // add new node to Record and save a reference to it |
| 64 | Node *node_ref = Record_AddNode(r, n->node_idx, newNode); |
| 65 | |
| 66 | // convert query-level properties |
| 67 | AttributeSet converted_attr = NULL; |
| 68 | PropertyMap *map = n->properties; |
| 69 | if(map != NULL) { |
| 70 | ConvertPropertyMap(gc, &converted_attr, r, map, false); |
| 71 | } |
| 72 | |
| 73 | // save node for later insertion |
| 74 | array_append(op->pending.created_nodes, node_ref); |
| 75 | |
| 76 | // save attributes to insert with node |
| 77 | array_append(op->pending.node_attributes, converted_attr); |
| 78 | |
| 79 | // save labels to assigned to node |
| 80 | array_append(op->pending.node_labels, n->labelsId); |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | // prepare to create all edges for the current Record |
| 85 | static void _CreateEdges |
no test coverage detected