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

Function Record_ToString

src/execution_plan/record.c:314–340  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

312}
313
314size_t Record_ToString
315(
316 const Record r,
317 char **buf,
318 size_t *buf_cap
319) {
320 uint rLen = Record_length(r);
321 SIValue values[rLen];
322 for(int i = 0; i < rLen; i++) {
323 if(Record_GetType(r, i) == REC_TYPE_UNKNOWN) {
324 values[i] = SI_ConstStringVal("UNKNOWN");
325 } else {
326 values[i] = Record_Get(r, i);
327 }
328 }
329
330 size_t required_len = SIValue_StringJoinLen(values, rLen, ",");
331
332 if(*buf_cap < required_len) {
333 *buf = rm_realloc(*buf, sizeof(char) * required_len);
334 *buf_cap = required_len;
335 }
336
337 size_t bytesWritten = 0;
338 SIValue_StringJoin(values, rLen, ",", buf, buf_cap, &bytesWritten);
339 return bytesWritten;
340}
341
342inline rax *Record_GetMappings
343(

Callers 1

test_recordToStringFunction · 0.85

Calls 7

Record_lengthFunction · 0.85
Record_GetTypeFunction · 0.85
SI_ConstStringValFunction · 0.85
Record_GetFunction · 0.85
SIValue_StringJoinLenFunction · 0.85
rm_reallocFunction · 0.85
SIValue_StringJoinFunction · 0.85

Tested by 1

test_recordToStringFunction · 0.68