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