| 520 | } |
| 521 | |
| 522 | void *db_col_arr_(const tal_t *ctx, struct db_stmt *stmt, const char *colname, |
| 523 | size_t bytes, const char *label, const char *caller) |
| 524 | { |
| 525 | size_t col = db_query_colnum(stmt, colname); |
| 526 | size_t sourcelen; |
| 527 | void *p; |
| 528 | |
| 529 | if (db_column_is_null(stmt, col)) |
| 530 | return NULL; |
| 531 | |
| 532 | sourcelen = db_column_bytes(stmt, col); |
| 533 | |
| 534 | if (sourcelen % bytes != 0) |
| 535 | db_fatal(stmt->db, "%s: %s/%zu column size for %zu not a multiple of %s (%zu)", |
| 536 | caller, colname, col, sourcelen, label, bytes); |
| 537 | |
| 538 | p = tal_arr_label(ctx, char, sourcelen, label); |
| 539 | if (sourcelen != 0) |
| 540 | memcpy(p, db_column_blob(stmt, col), sourcelen); |
| 541 | return p; |
| 542 | } |
| 543 | |
| 544 | void db_col_amount_msat_or_default(struct db_stmt *stmt, |
| 545 | const char *colname, |
nothing calls this directly
no test coverage detected