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

Function db_query_colnum

db/utils.c:16–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14}
15
16size_t db_query_colnum(const struct db_stmt *stmt,
17 const char *colname)
18{
19 u32 col;
20
21 assert(stmt->query->colnames != NULL);
22
23 col = hash_djb2(colname) % stmt->query->num_colnames;
24 /* Will crash on NULL, which is the Right Thing */
25 while (!streq(stmt->query->colnames[col].sqlname,
26 colname)) {
27 col = (col + 1) % stmt->query->num_colnames;
28 }
29
30#if DEVELOPER
31 strset_add(stmt->cols_used, colname);
32#endif
33
34 return stmt->query->colnames[col].val;
35}
36
37static void db_stmt_free(struct db_stmt *stmt)
38{

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_preimageFunction · 0.85
db_col_channel_idFunction · 0.85
db_col_node_idFunction · 0.85
db_col_node_id_arrFunction · 0.85
db_col_pubkeyFunction · 0.85

Calls 2

strset_addFunction · 0.85
hash_djb2Function · 0.70

Tested by

no test coverage detected