Repository navigation
feat(orm): map rows and add synchronous CRUD - #100
Merged
Merged
Conversation
Add find_by_pk/find_all/insert/update/remove/count on uvcpp_db_client, with exact column binding, nullable/NULL handling, checked integer conversion, BLOB/string mapping, primary-key based update/remove and explicit DB status propagation. Add the SQLite CRUD test (117 checks), a first ORM guide, and link the SQLite client for ORM execution tests in static builds.
Register the ORM public headers in the snippet gate and wrap the executable examples in main() so the documentation gate builds every block.
Owner
Author
|
Local review before merge: SQLite ORM CRUD 117/117, ORM model 192/192, ORM SQL 295/295, DB SQLite 196 passed / 0 failed / 1 N/A, static build passes, ORM=OFF leaves no ORM tests. Guide snippets compile against the installed package; MySQL/PostgreSQL/ODBC and transactions/async are explicitly unverified/out of scope. |
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.
Closes #91. Parent: #88. Stacked on #98 (
feat/orm-sql) and #96 (feat/orm-model); retarget tomasterafter #96/#98 merge.What changed
Adds the synchronous single-table execution layer:
src/orm/uvcpp_orm_repository.hfind_by_pk<T>,find_all<T>(constructed SQL or SELECT builder),insert<T>,update<T>,remove<T>,count<T>;uvcpp_db_client/uvcpp_db_params; no new connection or transaction;nullable<T>; missing non-null columns fail before mapping any row;last_insert_id;affected == 0isOKwithaffected0; execution failure keeps the backenduvcpp_db_statusanddb.last_error().NOT_FOUND,MAPPING_FAILED,MISSING_COLUMN,TYPE_MISMATCH,NULL_VIOLATION,DB_ERROR,INVALID_ARGUMENT.doc/orm-guide.md— first single-table CRUD guide with the transaction/async boundaries stated as future work.tests/functional/orm_sqlite_func.cpp— real SQLite CRUD coverage.orm_*execution tests.Verification
C++11
-pedantic-errors -Wall -Wextra -fsyntax-onlyexits 0. Static library build also passes the 117 checks. With ORM=OFF there are noorm_*tests andtest_db_sqlite_funcstill passes.Covered in the SQLite test: insert/auto id, primary-key and condition lookups, count with limit, update/delete/0-row results, NULL vs empty string, integer bounds, double/bool/BLOB, missing/unexpected columns, type mismatch, NULL into non-null, unique conflict and invalid arguments.
Known limits / unverified
src/db/was not changed.find_all(const uvcpp_orm_sql_result&, ..., total)derivesCOUNT(*)from the builder-shaped SELECT. It rejects raw SELECT lists containing placeholders; use the builder overload or explicitcount<T>()in that case.