A C++ application that uses Boost.Spirit X3 to parse SQL files and extract table definitions, then generates corresponding C++ header files.
- Parses SQL files to extract table definitions.
- Generates C++ header files based on parsed table definitions.
- CMake 3.28 or higher
- Boost 1.84 (tested with this version only)
-
Clone the repository:
git clone https://github.com/cyberium/Sql2CppHeader.git cd Sql2CppHeader
-
Set up Boost:
- Ensure the
BOOST_ROOT
environment variable points to your Boost 1.84 installation directory.
- Ensure the
Run CMake and build:
cmake -H. -Bbuild [-DDISABLE_TESTS=ON]
cmake --build build --config Release
Build options:
[-DDISABLE_TESTS=ON]
use this only if you want to disable testing.
-H.
option is not mandatory if you are in root folder, else -H
should be followed by source folder. Please refer to cmake documentation.
Run the application with the input SQL file and the desired output header file:
./build/src/parser/Release/Sql2CppHeader -i <input_sql_file> -o <output_header_file>
Example:
./build/src/parser/Release/Sql2CppHeader input.sql output.h
-i, --input <file>
: Specify the input SQL file.-o, --output <file>
: Specify the output header file.-v, --verbose
: Enable verbose output.-h, --help
: Show help message.
Command to use:
ctest -C Release --output-on-failure --test-dir build
- Boost.Test: Used for unit testing the application.
- Boost.Spirit X3: Used for parsing SQL files.
This project is licensed under the MIT License.