A small SQL parser.
If you have a GitHub account setup with SSH, just do this:
git clone --recurse-submodules git@github.com:leissa/sql.gitOtherwise, clone via HTTPS:
git clone --recurse-submodules https://github.com/leissa/sql.gitThen, build with:
cd sql
cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug
cmake --build build -j $(nproc)For a Release build simply use -DCMAKE_BUILD_TYPE=Release.
Test:
./build/bin/sql -d test/select.sqlUse the following coding conventions:
- class/type names in
CamelCase - constants as defined in an
enumor viastatic constinCamel_Snake_Case - macro names in
SNAKE_IN_ALL_CAPS - everything else like variables, functions, etc. in
snake_case - use a trailing underscore suffix for a
private_or_protected_member_variable_ - don't do that for a
public_member_variable - use
structfor plain old data - use
classfor everything else - visibility groups in this order:
publicprotectedprivate
- prefer
// C++-style commentsover/* C-style comments */ - use
/// three slashes for Doxygenand group your methods into logical units if possible - use Markdown-style Doxygen comments
- methods/functions that return a
boolshould be prefixed withis_ - methods/functions that return a
std::optionalor a pointer that may benullptrshould be prefixed withisa_
For all the other minute details like indentation width etc. use clang-format and the provided .clang-format file in the root of the repository.
In order to run clang-format automatically on all changed files, switch to the provided pre-commit hook:
git config --local core.hooksPath .githooks/Note that you can disable clang-format for a piece of code. In addition, you might want to check out plugins like the Vim integration.