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

Function ResultSet_Reply

src/resultset/resultset.c:225–260  ·  view source on GitHub ↗

flush resultset to network

Source from the content-addressed store, hash-verified

223
224// flush resultset to network
225void ResultSet_Reply
226(
227 ResultSet *set // resultset to reply with
228) {
229 ASSERT(set != NULL);
230
231 uint64_t row_count = ResultSet_RowCount(set);
232
233 // check to see if we've encountered a run-time error
234 // if so, emit it as the only response
235 if(ErrorCtx_EncounteredError()) {
236 ErrorCtx_EmitException();
237 return;
238 }
239
240 // set up the results array and emit the header if the query requires one
241 _ResultSet_ReplyWithPreamble(set);
242
243 // emit resultset
244 if(set->column_count > 0) {
245 RedisModule_ReplyWithArray(set->ctx, row_count);
246 SIValue *row[set->column_count];
247 uint64_t cells = DataBlock_ItemCount(set->cells);
248 // for each row
249 for(uint64_t i = 0; i < cells; i += set->column_count) {
250 // for each column
251 for(uint j = 0; j < set->column_count; j++) {
252 row[j] = DataBlock_GetItem(set->cells, i + j);
253 }
254
255 set->formatter->EmitRow(set->ctx, set->gc, row, set->column_count);
256 }
257 }
258
259 ResultSetStat_emit(set->ctx, &set->stats); // response with statistics
260}
261
262void ResultSet_Clear(ResultSet *set) {
263 ASSERT(set != NULL);

Callers 1

_ExecuteQueryFunction · 0.85

Calls 7

ResultSet_RowCountFunction · 0.85
ErrorCtx_EmitExceptionFunction · 0.85
DataBlock_ItemCountFunction · 0.85
DataBlock_GetItemFunction · 0.85
ResultSetStat_emitFunction · 0.85

Tested by

no test coverage detected