| 1544 | } |
| 1545 | |
| 1546 | static 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) */ |
| 1570 | static void add_sub_object(char **insert_stmt, char **create_stmt, |
nothing calls this directly
no test coverage detected