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

Function db_column_name

plugins/sql.c:1682–1696  ·  view source on GitHub ↗

Don't use SQL keywords as column names: sure, you can use quotes, * but it's a PITA. */

Source from the content-addressed store, hash-verified

1680/* Don't use SQL keywords as column names: sure, you can use quotes,
1681 * but it's a PITA. */
1682static 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 */
1699static const char *db_table_name(const tal_t *ctx, const char *cmdname)

Callers 2

add_table_singletonFunction · 0.85
add_table_propertiesFunction · 0.85

Calls 1

json_strdupFunction · 0.50

Tested by

no test coverage detected