MCPcopy Create free account
hub / github.com/ElementsProject/lightning / default_list_done

Function default_list_done

plugins/sql.c:949–975  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

947}
948
949static struct command_result *default_list_done(struct command *cmd,
950 const char *method,
951 const char *buf,
952 const jsmntok_t *result,
953 struct db_query *dbq)
954{
955 struct sql *sql = sql_of(cmd->plugin);
956 struct table_desc *td = dbq->tables[0];
957 struct command_result *ret;
958 int err;
959 char *errmsg;
960
961 /* FIXME: this is where a wait / pagination API is useful! */
962 err = sqlite3_exec(sql->db, tal_fmt(tmpctx, "DELETE FROM %s;", td->name),
963 NULL, NULL, &errmsg);
964 if (err != SQLITE_OK) {
965 return command_fail(cmd, LIGHTNINGD, "cleaning '%s' failed: %s",
966 td->name, errmsg);
967 }
968
969 ret = process_json_result(cmd, buf, result, td, false,
970 &td->last_created_index, &td->last_updated_index, NULL);
971 if (ret)
972 return ret;
973
974 return one_refresh_done(cmd, dbq, false);
975}
976
977static struct command_result *default_refresh(struct command *cmd,
978 struct table_desc *td,

Callers

nothing calls this directly

Calls 4

sql_ofFunction · 0.85
process_json_resultFunction · 0.85
one_refresh_doneFunction · 0.85
command_failFunction · 0.70

Tested by

no test coverage detected