| 5196 | } |
| 5197 | |
| 5198 | struct db_stmt *wallet_datastore_first(const tal_t *ctx, |
| 5199 | struct wallet *w, |
| 5200 | const char **startkey, |
| 5201 | const char ***key, |
| 5202 | const u8 **data, |
| 5203 | u64 *generation) |
| 5204 | { |
| 5205 | struct db_stmt *stmt; |
| 5206 | |
| 5207 | if (startkey) { |
| 5208 | stmt = db_prepare_v2(w->db, |
| 5209 | SQL("SELECT key, data, generation" |
| 5210 | " FROM datastore" |
| 5211 | " WHERE key >= ?" |
| 5212 | " ORDER BY key;")); |
| 5213 | db_bind_datastore_key(stmt, 0, startkey); |
| 5214 | } else { |
| 5215 | stmt = db_prepare_v2(w->db, |
| 5216 | SQL("SELECT key, data, generation" |
| 5217 | " FROM datastore" |
| 5218 | " ORDER BY key;")); |
| 5219 | } |
| 5220 | db_query_prepared(stmt); |
| 5221 | |
| 5222 | return wallet_datastore_next(ctx, w, stmt, key, data, generation); |
| 5223 | } |
| 5224 | |
| 5225 | struct db_stmt *wallet_datastore_next(const tal_t *ctx, |
| 5226 | struct wallet *w, |
no test coverage detected