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