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.git
Otherwise, clone via HTTPS:
git clone --recurse-submodules https://github.com/leissa/sql.git
Then, 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.sql
Use the following coding conventions:
- class/type names in
CamelCase
- constants as defined in an
enum
or viastatic const
inCamel_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
struct
for plain old data - use
class
for everything else - visibility groups in this order:
public
protected
private
- prefer
// C++-style comments
over/* C-style comments */
- use
/// three slashes for Doxygen
and group your methods into logical units if possible - use Markdown-style Doxygen comments
- methods/functions that return a
bool
should be prefixed withis_
- methods/functions that return a
std::optional
or a pointer that may benullptr
should 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.