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

Function db_query_colnum

db/utils.c:18–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16}
17
18size_t db_query_colnum(const struct db_stmt *stmt,
19 const char *colname)
20{
21 u32 col;
22
23 assert(stmt->query->colnames != NULL);
24
25 col = hash_djb2(colname) % stmt->query->num_colnames;
26 for (;;) {
27 const char *n = stmt->query->colnames[col].sqlname;
28 if (!n)
29 db_fatal(stmt->db, "Unknown column name %s in query %s",
30 colname, stmt->query->query);
31 if (streq(n, colname))
32 break;
33 col = (col + 1) % stmt->query->num_colnames;
34 }
35
36 if (stmt->db->developer)
37 strset_add(stmt->cols_used, colname);
38
39 return stmt->query->colnames[col].val;
40}
41
42static void db_stmt_free(struct db_stmt *stmt)
43{

Callers 15

db_col_intFunction · 0.85
db_col_is_nullFunction · 0.85
db_col_u64Function · 0.85
db_col_int_or_defaultFunction · 0.85
db_col_bytesFunction · 0.85
db_col_blobFunction · 0.85
db_col_strdupFunction · 0.85
db_col_strdup_optionalFunction · 0.85
db_col_preimageFunction · 0.85
db_col_channel_idFunction · 0.85
db_col_node_idFunction · 0.85
db_col_node_id_arrFunction · 0.85

Calls 3

db_fatalFunction · 0.85
strset_addFunction · 0.85
hash_djb2Function · 0.70

Tested by

no test coverage detected