Don't use SQL keywords as column names: sure, you can use quotes, * but it's a PITA. */
| 1680 | /* Don't use SQL keywords as column names: sure, you can use quotes, |
| 1681 | * but it's a PITA. */ |
| 1682 | static const char *db_column_name(const tal_t *ctx, |
| 1683 | const struct table_desc *td, |
| 1684 | const jsmntok_t *nametok) |
| 1685 | { |
| 1686 | const char *name = json_strdup(tmpctx, schemas, nametok); |
| 1687 | |
| 1688 | if (streq(name, "index")) |
| 1689 | name = tal_strdup(tmpctx, "idx"); |
| 1690 | |
| 1691 | /* Prepend td->name to make column unique in table. */ |
| 1692 | if (td->is_subobject) |
| 1693 | return tal_fmt(ctx, "%s_%s", td->cmdname, name); |
| 1694 | |
| 1695 | return tal_steal(ctx, name); |
| 1696 | } |
| 1697 | |
| 1698 | /* Remove 'list', turn - into _ in name */ |
| 1699 | static const char *db_table_name(const tal_t *ctx, const char *cmdname) |
no test coverage detected