Skip to content

Improve sqlpp23-ddl2cpp custom types mapping#128

Open
rbock wants to merge 2 commits into
developfrom
improve-ddl2cpp-custom-types-1074235339693974878
Open

Improve sqlpp23-ddl2cpp custom types mapping#128
rbock wants to merge 2 commits into
developfrom
improve-ddl2cpp-custom-types-1074235339693974878

Conversation

@rbock

@rbock rbock commented Jun 7, 2026

Copy link
Copy Markdown
Owner

I have improved scripts/sqlpp23-ddl2cpp to better handle custom type mappings.

Key changes:

  1. Arbitrary C++ Types: The --path-to-custom-types CSV mapping now supports any C++ type as a "base type". If the base type is not a built-in sqlpp type, the script creates a new parser for the associated SQL types.
  2. Namespace Handling:
    • Unqualified C++ type names (e.g., integral, my_type) are now implicitly prefixed with ::sqlpp:: in the generated code.
    • Qualified C++ type names (e.g., boost::uuid, my_ns::my_type) are treated as custom types and used exactly as provided.
  3. Consistent Annotations: This same logic applies to cpp_type annotations in the DDL, ensuring consistent behavior across all type override mechanisms.
  4. Improved Parser Initialization: DdlParser.initialize now copies the built-in type lists before extending them, preventing side effects when the parser is re-initialized (which is common in unit tests).
  5. Updated Tests:
    • scripts/sqlpp23-ddl2cpp-unit-tests now includes cases for qualified vs. unqualified types from both mappings and annotations.
    • Integration tests in tests/scripts/ have been updated with a new UUID SQL type mapping to my_ns::uuid to exercise the new functionality.

These changes provide more flexibility for users to map SQL types to their own C++ types while maintaining a clean and consistent naming convention for standard sqlpp types.


PR created automatically by Jules for task 1074235339693974878 started by @rbock

- Extend --path-to-custom-types to support arbitrary C++ types.
- Implicitly prefix unqualified C++ type names with ::sqlpp::.
- Treat qualified C++ type names (containing ::) as custom types and use as-is.
- Allow custom base types in mapping CSV even if they are not built-in sqlpp types.
- Ensure side-effect-free parser initialization by copying built-in type lists.
- Update unit tests and integration tests to cover new functionality.

Co-authored-by: rbock <5185185+rbock@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

- Extend --path-to-custom-types to support arbitrary C++ types.
- Implicitly prefix unqualified C++ type names with ::sqlpp::.
- Treat qualified C++ type names (containing ::) as custom types and use as-is.
- Allow custom base types in mapping CSV even if they are not built-in sqlpp types.
- Fix compilation in integration tests by reordering includes and custom type definitions.
- Update unit tests and integration tests to cover new functionality.

Co-authored-by: rbock <5185185+rbock@users.noreply.github.com>
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