Remove the now-unused GetMaxId API (#10)#29
Merged
Conversation
GetMaxId and its backing FetchMaxIdQuery only existed to support the old client-side SaveAutoIncrement (SELECT MAX(id) + 1). Since #8, SaveAutoIncrement relies on SQLite's native AUTOINCREMENT and sqlite3_last_insert_rowid(), so nothing in the library uses GetMaxId anymore and it was the last remnant of the user-space id scheme. Removes: - Database::GetMaxId() (public template) and the private GetMaxId(Reflection&) - FetchMaxIdQuery (declaration and implementation) - the ReadMaxId test This is a minor breaking change to the public API. Full suite green (58 tests). Closes #10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #10. Removes
GetMaxIdand its backingFetchMaxIdQuery(Option A from the issue).GetMaxIdonly existed to support the old client-sideSaveAutoIncrementimplementation, which computed the next id asSELECT MAX(id) + 1. Since #8,SaveAutoIncrementrelies on SQLite's nativeINTEGER PRIMARY KEY AUTOINCREMENTand reads the id back viasqlite3_last_insert_rowid(), so nothing in the library usesGetMaxIdanymore — it was the last remnant of the user-space id scheme.What changed
Database::GetMaxId()(public template) and the privateGetMaxId(const Reflection&).FetchMaxIdQuery— declaration (include/queries.h) and implementation (src/queries.cc).ReadMaxIdtest (tests/database_test.cc).81 deletions, no additions;
grepconfirms zero remaining references.Compatibility
Minor breaking change to the public API, as called out in #10. Callers that want the current maximum id can run the equivalent
SELECT MAX(id) FROM <table>viaUnsafeSql.Tests
Full suite green locally (58 tests, down one from the removed
ReadMaxIdtest).https://claude.ai/code/session_01YLXHcZjrnrdhRZAgqDh6kd
Generated by Claude Code