Skip to content

Conversation

@laihoutang
Copy link

  • Introduced DECLARE_SQLITE_FIELDS macro for declarative mapping of C++ structs to SQLite tables.

    • Enables ORM-style interaction by registering fields and their corresponding column names.
    • Simplifies querying and data binding using typed structs like UserInfo.
  • Implemented fluent db.create_table("table") DSL for defining SQLite schemas in a readable, chainable syntax.

    • Supports field types (INTEGER, TEXT, BLOB, REAL), constraints (NOT NULL, PRIMARY KEY, AUTOINCREMENT), default values, and string size limits.
    • Used to define tables such as "user" and "people" with full schema control.
  • Extended support for standard library numeric and boolean types:

    • Added explicit specializations for bool, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t.
    • Improved value extraction and binding from SQLite statements.
    • Enhanced type safety and range checks when enabled via SQLITELIB_ENABLE_TYPE_CHECKING.
  • Comprehensive test coverage added:

    • Insertion and querying of structured data.
    • Field binding and result iteration.
    • Exception handling for invalid operations and malformed queries.

This change significantly improves the usability, expressiveness, and robustness of the SQLite ORM layer.

laihoutang added 2 commits May 5, 2025 10:24
- Introduced DECLARE_SQLITE_FIELDS macro for declarative mapping of C++ structs to SQLite tables.
  - Enables ORM-style interaction by registering fields and their corresponding column names.
  - Simplifies querying and data binding using typed structs like UserInfo.

- Implemented fluent db.create_table("table") DSL for defining SQLite schemas in a readable, chainable syntax.
  - Supports field types (INTEGER, TEXT, BLOB, REAL), constraints (NOT NULL, PRIMARY KEY, AUTOINCREMENT), default values, and string size limits.
  - Used to define tables such as "user" and "people" with full schema control.

- Extended support for standard library numeric and boolean types:
  - Added explicit specializations for bool, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t.
  - Improved value extraction and binding from SQLite statements.
  - Enhanced type safety and range checks when enabled via SQLITELIB_ENABLE_TYPE_CHECKING.

- Comprehensive test coverage added:
  - Insertion and querying of structured data.
  - Field binding and result iteration.
  - Exception handling for invalid operations and malformed queries.

This change significantly improves the usability, expressiveness, and robustness of the SQLite ORM layer.
…erage

This commit extends the SQLITELIB_FOR_EACH_RMAP macro support to handle up to 80 fields, improving flexibility for mapping large structs to SQLite tables. It also includes new test cases to validate the functionality of expanded field registration and struct mapping behavior with a higher number of fields.
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.

1 participant