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

Function json_listsqlschemas

plugins/sql.c:1546–1567  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1544}
1545
1546static struct command_result *json_listsqlschemas(struct command *cmd,
1547 const char *buffer,
1548 const jsmntok_t *params)
1549{
1550 struct sql *sql = sql_of(cmd->plugin);
1551 struct table_desc *td;
1552 struct json_stream *ret;
1553
1554 if (!param(cmd, buffer, params,
1555 p_opt("table", param_tablename, &td),
1556 NULL))
1557 return command_param_failed();
1558
1559 ret = jsonrpc_stream_success(cmd);
1560 json_array_start(ret, "schemas");
1561 if (td)
1562 json_add_schema(ret, td);
1563 else
1564 strmap_iterate(&sql->tablemap, add_one_schema, ret);
1565 json_array_end(ret);
1566 return command_finished(cmd, ret);
1567}
1568
1569/* Adds a sub_object to this sql statement (and sub-sub etc) */
1570static void add_sub_object(char **insert_stmt, char **create_stmt,

Callers

nothing calls this directly

Calls 8

sql_ofFunction · 0.85
json_array_startFunction · 0.85
json_add_schemaFunction · 0.85
json_array_endFunction · 0.85
command_param_failedFunction · 0.70
jsonrpc_stream_successFunction · 0.70
command_finishedFunction · 0.70
paramFunction · 0.50

Tested by

no test coverage detected