The impacted row whose qualified name ends in `.name`, from a format:"json" * answer. NULL when the row is absent. */
| 17553 | /* The impacted row whose qualified name ends in `.name`, from a format:"json" |
| 17554 | * answer. NULL when the row is absent. */ |
| 17555 | static yyjson_val *dc_walk_row(yyjson_doc *doc, const char *name) { |
| 17556 | yyjson_val *rows = doc ? yyjson_obj_get(yyjson_doc_get_root(doc), "impacted") : NULL; |
| 17557 | size_t want = strlen(name); |
| 17558 | size_t idx; |
| 17559 | size_t max; |
| 17560 | yyjson_val *row; |
| 17561 | yyjson_arr_foreach(rows, idx, max, row) { |
| 17562 | const char *qn = yyjson_get_str(yyjson_obj_get(row, "qn")); |
| 17563 | size_t len = qn ? strlen(qn) : 0; |
| 17564 | if (len > want && qn[len - want - 1U] == '.' && strcmp(qn + len - want, name) == 0) { |
| 17565 | return row; |
| 17566 | } |
| 17567 | } |
| 17568 | return NULL; |
| 17569 | } |
| 17570 | |
| 17571 | static int dc_walk_total(yyjson_doc *doc) { |
| 17572 | return doc ? (int)yyjson_get_int(yyjson_obj_get(yyjson_doc_get_root(doc), "impacted_total")) |