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

Function db_exec_prepared_v2

db/utils.c:176–204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

174}
175
176void db_exec_prepared_v2(struct db_stmt *stmt TAKES)
177{
178 bool ret;
179
180 db_need_transaction(stmt->db, stmt->query->query);
181 trace_span_start("db_exec_prepared", stmt);
182 trace_span_tag(stmt, "query", stmt->query->query);
183 ret = stmt->db->config->exec_fn(stmt);
184 trace_span_end(stmt);
185
186 if (stmt->db->readonly)
187 assert(stmt->query->readonly);
188
189 /* If this was a write we need to bump the data_version upon commit. */
190 stmt->db->dirty = stmt->db->dirty || !stmt->query->readonly;
191
192 stmt->executed = true;
193 list_del_from(&stmt->db->pending_statements, &stmt->list);
194
195 /* The driver itself doesn't call `fatal` since we want to override it
196 * for testing. Instead we check here that the error message is set if
197 * we report an error. */
198 if (!ret) {
199 assert(stmt->error);
200 db_fatal(stmt->db, "Error executing statement: %s", stmt->error);
201 }
202
203 tal_free_if_taken(stmt);
204}
205
206size_t db_count_changes(struct db_stmt *stmt)
207{

Callers 15

mainFunction · 0.85
migrate_from_account_dbFunction · 0.85
db_datastore_updateFunction · 0.85
db_migrateFunction · 0.85
migrate_our_fundingFunction · 0.85
migrate_last_tx_to_psbtFunction · 0.85

Calls 6

db_need_transactionFunction · 0.85
trace_span_tagFunction · 0.85
trace_span_endFunction · 0.85
list_del_fromFunction · 0.85
db_fatalFunction · 0.85
tal_free_if_takenFunction · 0.85

Tested by 5

test_primitivesFunction · 0.68
test_manip_columnsFunction · 0.68
test_htlc_crudFunction · 0.68
mainFunction · 0.68
populate_dbFunction · 0.68