| 35 | } |
| 36 | |
| 37 | static 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 | |
| 64 | static struct db_stmt *db_prepare_core(struct db *db, |
nothing calls this directly
no test coverage detected