mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-19 05:07:56 +00:00
Improve Rhizome list cursor
Separate function rhizome_list_commit() which, if not called, causes the next list re-query to include the last row that was fetched with rhizome_list_next(), rather than excluding it.
This commit is contained in:
parent
32ce7f5ed9
commit
a62b6f9250
@ -631,6 +631,7 @@ struct rhizome_list_cursor {
|
||||
|
||||
int rhizome_list_open(sqlite_retry_state *, struct rhizome_list_cursor *);
|
||||
int rhizome_list_next(sqlite_retry_state *, struct rhizome_list_cursor *);
|
||||
void rhizome_list_commit(struct rhizome_list_cursor *);
|
||||
void rhizome_list_release(struct rhizome_list_cursor *);
|
||||
|
||||
/* one manifest is required per candidate, plus a few spare.
|
||||
|
@ -1487,10 +1487,6 @@ int rhizome_list_next(sqlite_retry_state *retry, struct rhizome_list_cursor *c)
|
||||
int64_t q_inserttime = sqlite3_column_int64(c->_statement, 3);
|
||||
const char *q_author = (const char *) sqlite3_column_text(c->_statement, 4);
|
||||
c->rowid = sqlite3_column_int64(c->_statement, 5);
|
||||
if (c->rowid > c->_rowid_first)
|
||||
c->_rowid_first = c->rowid;
|
||||
if (c->_rowid_last == 0 || c->rowid < c->_rowid_last)
|
||||
c->_rowid_last = c->rowid;
|
||||
sid_t *author = NULL;
|
||||
if (q_author) {
|
||||
author = alloca(sizeof *author);
|
||||
@ -1528,6 +1524,15 @@ int rhizome_list_next(sqlite_retry_state *retry, struct rhizome_list_cursor *c)
|
||||
OUT();
|
||||
}
|
||||
|
||||
void rhizome_list_commit(struct rhizome_list_cursor *c)
|
||||
{
|
||||
assert(c->rowid != 0);
|
||||
if (c->rowid > c->_rowid_first)
|
||||
c->_rowid_first = c->rowid;
|
||||
if (c->_rowid_last == 0 || c->rowid < c->_rowid_last)
|
||||
c->_rowid_last = c->rowid;
|
||||
}
|
||||
|
||||
void rhizome_list_release(struct rhizome_list_cursor *c)
|
||||
{
|
||||
if (c->manifest) {
|
||||
|
Loading…
Reference in New Issue
Block a user