read the property keys from a header
| 87 | |
| 88 | // read the property keys from a header |
| 89 | static Attribute_ID* _BulkInsert_ReadHeaderProperties |
| 90 | ( |
| 91 | GraphContext* gc, |
| 92 | SchemaType t, |
| 93 | const char* data, |
| 94 | size_t* data_idx, |
| 95 | uint* prop_count |
| 96 | ) { |
| 97 | ASSERT(gc != NULL); |
| 98 | ASSERT(data != NULL); |
| 99 | ASSERT(data_idx != NULL); |
| 100 | ASSERT(prop_count != NULL); |
| 101 | |
| 102 | // next 4 bytes are property count |
| 103 | *prop_count = *(uint*)&data[*data_idx]; |
| 104 | *data_idx += sizeof(unsigned int); |
| 105 | |
| 106 | if (*prop_count == 0) return NULL; |
| 107 | |
| 108 | Attribute_ID* prop_indices = rm_malloc(*prop_count * sizeof(Attribute_ID)); |
| 109 | |
| 110 | // the rest of the line is [char *prop_key] * prop_count |
| 111 | for (uint j = 0; j < *prop_count; j++) { |
| 112 | char* prop_key = (char*)data + *data_idx; |
| 113 | *data_idx += strlen(prop_key) + 1; |
| 114 | |
| 115 | // add properties to schemas |
| 116 | prop_indices[j] = GraphContext_FindOrAddAttribute(gc, prop_key, NULL); |
| 117 | } |
| 118 | |
| 119 | return prop_indices; |
| 120 | } |
| 121 | |
| 122 | // read an SIValue from the data stream and update the index appropriately |
| 123 | static SIValue _BulkInsert_ReadProperty |
no test coverage detected