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

Function db_stmt_free

db/utils.c:37–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35}
36
37static void db_stmt_free(struct db_stmt *stmt)
38{
39 if (!stmt->executed)
40 db_fatal("Freeing an un-executed statement from %s: %s",
41 stmt->location, stmt->query->query);
42#if DEVELOPER
43 /* If they never got a db_step, we don't track */
44 if (stmt->cols_used) {
45 for (size_t i = 0; i < stmt->query->num_colnames; i++) {
46 if (!stmt->query->colnames[i].sqlname)
47 continue;
48 if (!strset_get(stmt->cols_used,
49 stmt->query->colnames[i].sqlname)) {
50 db_fatal("Never accessed column %s in query %s",
51 stmt->query->colnames[i].sqlname,
52 stmt->query->query);
53 }
54 }
55 strset_clear(stmt->cols_used);
56 }
57#endif
58 if (stmt->inner_stmt)
59 stmt->db->config->stmt_free_fn(stmt);
60 assert(stmt->inner_stmt == NULL);
61}
62
63
64static struct db_stmt *db_prepare_core(struct db *db,

Callers

nothing calls this directly

Calls 3

strset_getFunction · 0.85
strset_clearFunction · 0.85
db_fatalFunction · 0.50

Tested by

no test coverage detected