| 62 | |
| 63 | |
| 64 | static 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 | |
| 92 | struct db_stmt *db_prepare_v2_(const char *location, struct db *db, |
| 93 | const char *query_id) |
no outgoing calls
no test coverage detected