Problem
Database::Instance() returns std::shared_ptr<const Database> (src/database.cc:108), yet the mutating operations Save, SaveAutoIncrement, Update, and Delete (include/database.h) are declared const and are therefore callable through that pointer-to-const even though they modify the underlying database.
Note: this issue originally said Instance() returns const Database&; PR #28 changed the return type to std::shared_ptr<const Database>. That does not resolve the issue — it arguably reinforces it, since every caller now holds a handle to a const Database and can still mutate persistent state through it.
Impact
Mechanically harmless (the SQLite handle is mutated through a sqlite3* member, which const doesn't protect), but the API misrepresents intent: a handle to const appears read-only while it can mutate persistent state. This is a design/maintainability smell and can mislead callers reasoning about thread-safety and aliasing.
Suggested direction
Either make the mutators non-const and have Instance() hand out a non-const handle for write access (possibly a separate const accessor for read-only use), or, if the const-singleton pattern is intentional, document the rationale explicitly.
Problem
Database::Instance()returnsstd::shared_ptr<const Database>(src/database.cc:108), yet the mutating operationsSave,SaveAutoIncrement,Update, andDelete(include/database.h) are declaredconstand are therefore callable through that pointer-to-consteven though they modify the underlying database.Impact
Mechanically harmless (the SQLite handle is mutated through a
sqlite3*member, whichconstdoesn't protect), but the API misrepresents intent: a handle toconstappears read-only while it can mutate persistent state. This is a design/maintainability smell and can mislead callers reasoning about thread-safety and aliasing.Suggested direction
Either make the mutators non-
constand haveInstance()hand out a non-const handle for write access (possibly a separate const accessor for read-only use), or, if the const-singleton pattern is intentional, document the rationale explicitly.