| 896 | } |
| 897 | |
| 898 | struct channel_event **list_channel_events_timebox(const tal_t *ctx, |
| 899 | struct db *db, |
| 900 | u64 start_time, |
| 901 | u64 end_time) |
| 902 | |
| 903 | { |
| 904 | struct db_stmt *stmt; |
| 905 | struct channel_event **results; |
| 906 | |
| 907 | stmt = db_prepare_v2(db, SQL("SELECT" |
| 908 | " e.id" |
| 909 | ", e.account_id" |
| 910 | ", a.name" |
| 911 | ", e.tag" |
| 912 | ", e.credit" |
| 913 | ", e.debit" |
| 914 | ", e.fees" |
| 915 | ", e.currency" |
| 916 | ", e.payment_id" |
| 917 | ", e.part_id" |
| 918 | ", e.timestamp" |
| 919 | ", e.ev_desc" |
| 920 | ", e.rebalance_id" |
| 921 | " FROM channel_events e" |
| 922 | " LEFT OUTER JOIN accounts a" |
| 923 | " ON a.id = e.account_id" |
| 924 | " WHERE e.timestamp > ?" |
| 925 | " AND e.timestamp <= ?" |
| 926 | " ORDER BY e.timestamp, e.id;")); |
| 927 | |
| 928 | db_bind_u64(stmt, 0, start_time); |
| 929 | db_bind_u64(stmt, 1, end_time); |
| 930 | db_query_prepared(stmt); |
| 931 | |
| 932 | results = tal_arr(ctx, struct channel_event *, 0); |
| 933 | while (db_step(stmt)) { |
| 934 | struct channel_event *e = stmt2channel_event(results, stmt); |
| 935 | tal_arr_expand(&results, e); |
| 936 | } |
| 937 | tal_free(stmt); |
| 938 | |
| 939 | return results; |
| 940 | } |
| 941 | |
| 942 | struct channel_event **list_channel_events(const tal_t *ctx, struct db *db) |
| 943 | { |
no test coverage detected