A header-only C++20 library that parses and plans SQL queries at compile time using constexpr metaprogramming.
Constexpr SQL is a header-only C++20 library that parses SQL queries and generates query plans entirely at compile time using constexpr metaprogramming. It allows developers to embed SQL directly in C++ code, transforming queries into optimized relational algebra expression trees with zero runtime overhead for parsing.
C++ developers working on performance-critical applications who need lightweight, compile-time SQL processing without linking to a full database engine, particularly those using GCC 9.0+ and C++20 features.
Developers choose Constexpr SQL for its unique compile-time SQL execution, eliminating runtime parsing overhead while providing a familiar SQL syntax. It's a single-header, dependency-free alternative to embedding heavier database libraries.
Header only library that parses and plans SQL queries at compile time
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
SQL queries are parsed and validated at compile time using constexpr recursive descent, eliminating all runtime interpretation costs as stated in the philosophy section.
It's a lightweight, dependency-free single-header library, making integration straightforward without complex build systems, per the GitHub description.
The library is correctness-tested against SQLite3 output for nearly 1.5 million queries, ensuring reliable behavior matching standard SQL engines.
Leverages C++20 features like class types in non-type template parameters (P0732R2) for constexpr string handling, enabling SQL queries as template parameters with string literals.
Key SQL features like INNER JOIN, GROUP BY, and ORDER BY are unsupported and listed as future work, limiting query complexity for real-world data processing.
Only supports GCC 9.0+ due to reliance on C++20 P0732R2, excluding projects on other compilers or older GCC versions, as explicitly stated in the README.
Multiple instantiations of the same sql::query type cause undefined behavior due to static members, forcing developers to use guarded scopes and increasing error-proneness.
Compiling without optimizations leads to template bloat and increased binary size, requiring careful build configuration as warned in the example compilation command.