Zotero is a free, easy-to-use tool to help you collect, organize, cite, and share your research sources.
![]() 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 |
||
---|---|---|
chrome | ||
components | ||
defaults/preferences | ||
resource | ||
styles@2a33b37ec4 | ||
test | ||
translators@0ef37cc957 | ||
.gitattributes | ||
.gitmodules | ||
.travis.yml | ||
chrome.manifest | ||
CONTRIBUTING.md | ||
COPYING | ||
install.rdf | ||
README.md | ||
update.rdf |
Zotero
Zotero is a free, easy-to-use tool to help you collect, organize, cite, and share your research sources.
Please post feature requests or bug reports to the Zotero Forums. If you're having trouble with Zotero, see Getting Help.
For more information on how to use this source code, see the Zotero wiki.