| 14 | } |
| 15 | |
| 16 | size_t db_query_colnum(const struct db_stmt *stmt, |
| 17 | const char *colname) |
| 18 | { |
| 19 | u32 col; |
| 20 | |
| 21 | assert(stmt->query->colnames != NULL); |
| 22 | |
| 23 | col = hash_djb2(colname) % stmt->query->num_colnames; |
| 24 | /* Will crash on NULL, which is the Right Thing */ |
| 25 | while (!streq(stmt->query->colnames[col].sqlname, |
| 26 | colname)) { |
| 27 | col = (col + 1) % stmt->query->num_colnames; |
| 28 | } |
| 29 | |
| 30 | #if DEVELOPER |
| 31 | strset_add(stmt->cols_used, colname); |
| 32 | #endif |
| 33 | |
| 34 | return stmt->query->colnames[col].val; |
| 35 | } |
| 36 | |
| 37 | static void db_stmt_free(struct db_stmt *stmt) |
| 38 | { |
no test coverage detected