| 138 | } |
| 139 | |
| 140 | struct db_stmt *db_datastore_first(const tal_t *ctx, |
| 141 | struct db *db, |
| 142 | const char **startkey, |
| 143 | const char ***key, |
| 144 | const u8 **data, |
| 145 | u64 *generation) |
| 146 | { |
| 147 | struct db_stmt *stmt; |
| 148 | |
| 149 | if (startkey) { |
| 150 | stmt = db_prepare_v2(db, |
| 151 | SQL("SELECT key, data, generation" |
| 152 | " FROM datastore" |
| 153 | " WHERE key >= ?" |
| 154 | " ORDER BY key;")); |
| 155 | db_bind_datastore_key(stmt, startkey); |
| 156 | } else { |
| 157 | stmt = db_prepare_v2(db, |
| 158 | SQL("SELECT key, data, generation" |
| 159 | " FROM datastore" |
| 160 | " ORDER BY key;")); |
| 161 | } |
| 162 | db_query_prepared(stmt); |
| 163 | |
| 164 | return db_datastore_next(ctx, stmt, startkey, key, data, generation); |
| 165 | } |
| 166 | |
| 167 | void db_datastore_update(struct db *db, const char **key, const u8 *data) |
| 168 | { |
no test coverage detected