Introduction

Welcome to the QueryC++ book. Here you will find all the documentation you will need to use and/or contribute to QueryC++.

QueryC++ is a header only C++ library create to avoid having SQL as raw strings in your C++ code.

License

QueryC++ is release under the BSD 3-Clause License. For further details see LICENSE.

Maintainer

Lars Nielsen (lars (at) obsidian (dash) wolf (dash) labs (dot) com) is the maintainer of QueryC++

Contribution

We welcome contributions to QueryC++ from the community. For a detailed guide on how to contribute, please see CONTRIBUTE.

Build and Install

This chapter covers how to build and install QueryC++ from source.

Requirements

For building Query C++ you will need

  1. A C++ compiler supporting C++20 (we recommend clang and g++)
  2. CMake minimum version 3.18
  3. A copy of the source code which you can get from at codeberg.org/ObsidianWolfLabs/querycpp

Build

From the root folder of the project run the commands below

mkdir build
cd build
cmake ..
make

This will do a few things.

  1. Most importantly it will build QueryC++.
  2. It will download all external dependencies needed to run unit tests and integration tests.
  3. It will build all unit test and integration test.

Install

In addition to the build steps in the previous build section. Run make install.

Run Unit Tests

In addition to the build steps in the previous build section.

make test

This will run all unit tests including those of dependencies required for unit testing and integration testing.

Basic Usage

To include all of QueryC++ in one go, you can include the querycpp.hpp file. This file includes all other header files from QueryC++ and enables full usage QueryC++.

We will mainly be using the query class, which is the which is the one we use to build queries.

#include <querycpp/querycpp.hpp>

int main(void)
{
    querycpp::query query;
    query.select("*").from("t").where().gt('id', 10);

    auto query_str = query.string();
}

We welcome contributions to QueryC++, both code contributions, bug reports, and feature request.

How to Contribute Code

  1. Fork the repository
  2. Make your changes
  3. Make a Pull Request.
    • Please Rebase on main before pull request is made

All code contributions must follow the projects coding style see 'contribution/codingstyle.md' on Codeberg. If your contribution violates the code style, you will get a comment asking to correct this.

Please provide descriptive commit message and clean your git history as much as possible, to ensure an informative git history. If you do not which to get pull request commits squashed on merge please say so in the pull request and inform us why.

Working with an Issue

If you wan to work on an issue, please go to an issue on the issue tracker and ask for it to be assigned to you. As soon as possible the issue will be assigned to you. When it is assigned to you can start working on the issue.

Working Without an Issue

If you want to add a new feature that has no preassigned issue. Please reach out before you start to see if the feature is relevant for QueryC++. We do not want you to waste time on a feature that we do not want in the library.

If the feature is deemed suitable for QueryC++, we will create an issue and assign it to you.

Clang-Tidy

Currently we are working on providing a Clang-Tidy file that follows our code style. But it is not ready yet.

How to Submit a Bug Report

Please open an issue on the issue tracker and label it Bug. Describe the bug as detailed as you can and provide steps to reproduce it. Minimal reproducible working examples are great!.

If we can reproduce it we will move it to the back log and fix as soon as possible. Otherwise we may add the Discussion label to the issue and continue and open discussion on how to fix the bug or help you get around it.

How to Submit a Feature Request

Create an issue and label it Enhancement. Please describe the feature your desire in as much detail as you can.

  • If you feature request is simple and it is accepted, we will add to the back log.
  • We will add the Discussion label if we find that the feature request is valid, but needs clarification.
  • If we reject the feature request we will do so in a comment why on the issue and label it won't fix
    • You will have the option to challenge this.
    • In the case we accept your challenge we will add the label Discussion
    • In the case it is still rejected we will remove the Enhancement and Discussion labels and provide a comment.
    • Else we will move it to the back log

Acknowledgement

In this chapter we acknowledge certain organisations and people.

Special Thanks to Selected Contributors

Tibold Kandari, for helping setting up containerised integration tests.

Time and Funding Acknowledgement

This project has preciously received support from Aarhus University Department of Electrical and Computer Engineering, Network Computing, Communications and Storage Group. These contributions lay in time allowed for a PhD student to contribute code to QueryC++. These contributions formed the beginning of QueryC++.