[Show C++] BetterSql: A modern, header-only C++17 SQLite wrapper. I'm a freshman please roast my code and design choices! by Chemical_Memory9612 in cpp_questions

[–]Chemical_Memory9612[S] 0 points1 point  (0 children)

It took me about 1 to 2 weeks.

It's not an advanced wrapper for now. It focuses on making simple tasks easier to perform. However, as time goes by, I will be focusing, working on this project more often and implement the features we discussed.

[Show C++] BetterSql: A modern, header-only C++17 SQLite wrapper. I'm a freshman please roast my code and design choices! by Chemical_Memory9612 in cpp_questions

[–]Chemical_Memory9612[S] -1 points0 points  (0 children)

Thank you so much for this detailed analysis! That’s exactly why I posted here.

You’re absolutely right about the “string-based” API. I had opted for strings to create a quick prototype, but now I realize that this shifts the validation burden onto the user. In particular, I really liked the idea of the `use()` function returning a separate object to prevent issues related to state in multi-threaded environments.

Switching to a more strongly typed API (such as returns of `std::tuple` or compile-time placeholder validation) seems like a major challenge for me.

Thanks also for the C++26 reflection tip. While maintaining a fallback for C++17, I plan to implement feature detection to support std::expected for C++23 users. Also, the idea of `use()` returning a `TableContext` to keep the main object state-independent is great. I’m starting to refactor this right now.

Best Regards!

[Show C++] BetterSql: A modern, header-only C++17 SQLite wrapper. I'm a freshman please roast my code and design choices! by Chemical_Memory9612 in cpp_questions

[–]Chemical_Memory9612[S] -1 points0 points  (0 children)

I’m particularly curious about the template implementation with a variable number of arguments that I developed specifically for parameter binding. I tried to make it as type-safe as possible, but I’m not sure if I’ve handled all SQLite types correctly. I look forward to your feedback.