fabc2ba6a2
Instead of getting batches of unused primary key ids, even if they're lower than other ids, which for some reason seemed like a good idea in 2008, just do a `MAX()` on the table at startup and return the next available id on each call to `Zotero.ID.get()`. This is much simpler, and not reusing ids allows them to be used as a chronological sort field. While SQLite's `SELECT last_insert_rowid()` could return auto-increment values, it's unsafe with async DB access, since a second `INSERT` can come in before the first `last_insert_rowid()` is called. This is true even in a transaction unless a function that calls it is never called in parallel (e.g., with `Zotero.Promise.all()`, which can be faster than sequential `yield`s). Note that the next id is always initialized as MAX() + 1, so if an object is added and then deleted, after a restart the same id will be given. (This is equivalent to (though unrelated to) SQLite's `INTEGER PRIMARY KEY` behavior, as opposed to its `INTEGER PRIMARY KEY AUTOINCREMENT` behavior.) Closes #993, Feed items out of order |
||
---|---|---|
.. | ||
content | ||
locale | ||
skin/default/zotero |