Skip to content

Remove the now-unused GetMaxId API (#10)#29

Merged
jkalias merged 1 commit into
mainfrom
claude/open-issues-list-60jh6y
Jun 16, 2026
Merged

Remove the now-unused GetMaxId API (#10)#29
jkalias merged 1 commit into
mainfrom
claude/open-issues-list-60jh6y

Conversation

@jkalias

@jkalias jkalias commented Jun 16, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #10. Removes GetMaxId and its backing FetchMaxIdQuery (Option A from the issue).

GetMaxId only existed to support the old client-side SaveAutoIncrement implementation, which computed the next id as SELECT MAX(id) + 1. Since #8, SaveAutoIncrement relies on SQLite's native INTEGER PRIMARY KEY AUTOINCREMENT and reads the id back via sqlite3_last_insert_rowid(), so nothing in the library uses GetMaxId anymore — it was the last remnant of the user-space id scheme.

What changed

  • Removed Database::GetMaxId() (public template) and the private GetMaxId(const Reflection&).
  • Removed FetchMaxIdQuery — declaration (include/queries.h) and implementation (src/queries.cc).
  • Removed the ReadMaxId test (tests/database_test.cc).

81 deletions, no additions; grep confirms 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> via UnsafeSql.

Tests

Full suite green locally (58 tests, down one from the removed ReadMaxId test).

https://claude.ai/code/session_01YLXHcZjrnrdhRZAgqDh6kd


Generated by Claude Code

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
@jkalias jkalias merged commit 218ca04 into main Jun 16, 2026
15 checks passed
@jkalias jkalias deleted the claude/open-issues-list-60jh6y branch June 16, 2026 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reconsider/remove the now-unused GetMaxId API

2 participants