| 437 | } |
| 438 | |
| 439 | void *db_col_arr_(const tal_t *ctx, struct db_stmt *stmt, const char *colname, |
| 440 | size_t bytes, const char *label, const char *caller) |
| 441 | { |
| 442 | size_t col = db_query_colnum(stmt, colname); |
| 443 | size_t sourcelen; |
| 444 | void *p; |
| 445 | |
| 446 | if (db_column_is_null(stmt, col)) |
| 447 | return NULL; |
| 448 | |
| 449 | sourcelen = db_column_bytes(stmt, col); |
| 450 | |
| 451 | if (sourcelen % bytes != 0) |
| 452 | db_fatal("%s: %s/%zu column size for %zu not a multiple of %s (%zu)", |
| 453 | caller, colname, col, sourcelen, label, bytes); |
| 454 | |
| 455 | p = tal_arr_label(ctx, char, sourcelen, label); |
| 456 | memcpy(p, db_column_blob(stmt, col), sourcelen); |
| 457 | return p; |
| 458 | } |
| 459 | |
| 460 | void db_col_amount_msat_or_default(struct db_stmt *stmt, |
| 461 | const char *colname, |
nothing calls this directly
no test coverage detected