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

Function db_prepare_core

db/utils.c:64–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62
63
64static struct db_stmt *db_prepare_core(struct db *db,
65 const char *location,
66 const struct db_query *db_query)
67{
68 struct db_stmt *stmt = tal(db, struct db_stmt);
69 size_t num_slots = db_query->placeholders;
70
71 /* Allocate the slots for placeholders/bindings, zeroed next since
72 * that sets the type to DB_BINDING_UNINITIALIZED for later checks. */
73 stmt->bindings = tal_arrz(stmt, struct db_binding, num_slots);
74 stmt->location = location;
75 stmt->error = NULL;
76 stmt->db = db;
77 stmt->query = db_query;
78 stmt->executed = false;
79 stmt->inner_stmt = NULL;
80
81 tal_add_destructor(stmt, db_stmt_free);
82
83 list_add(&db->pending_statements, &stmt->list);
84
85#if DEVELOPER
86 stmt->cols_used = NULL;
87#endif /* DEVELOPER */
88
89 return stmt;
90}
91
92struct db_stmt *db_prepare_v2_(const char *location, struct db *db,
93 const char *query_id)

Callers 2

db_prepare_v2_Function · 0.85
db_prepare_untranslatedFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected