I love C++, and I love PostgreSQL. What I do not like is writing raw SQL queries using string in C++. First of all, I do not like to see SQL query strings in C++, and two developers (my self included) sometimes make syntax errors that we cannot catch on compile-time. Therefore, to reduce the potential for errors, I have been looking for libraries to solve this. Sadly the libraries I found were either out-of-date or tricky to set up correctly and was too complex for simply generating queries. For this reason, I decided to create a new library called QueryC++ to provide a bare-bone simple library for generating SQL queries in C++. Additionally, the purpose is also to provide a modern library that takes advantage of the latest features in C++17 and 20.

The library is open source under the BSD license and is available on GitHub: looopTools/querycpp. The project is still in its infant stage and not ready for production usage, but I wanted to share information about it such that people can follow along in the development process and give me input.

Additionally, the project serves as a learning experience for me as I plan to include build-chains for CMake and a Conan package, where I have limited experience. Besides CMake, there will also be provided build scripts for waf.io, and standard Make to accommodate most macOS, Linux, and BSD users (sorry, Windows, you will have to wait a bit).

ROAD MAP: The current road map for the project is to provide full support for PostgreSQL SQL syntax supporting all our favourite commands. The first step will be to get basic SELECT statements of the ground and build up from there. Hopefully, we will see an alpha release of the project in late April start May.

Plan for other databases: The benefit of most relational databases is that their languages are very similar, and queries (most of the time) works across SQL dialects. But some (quite a few) special cases exist, and we will have to address them to make QueryC++ work with other databases, and this is the plan. I just decided to start with PostgreSQL because it is the database I favour working with. The plan for adopting other databases is that when I am adequate satisfied with PostgreSQL compatibility, I will start implementing support for MariaDB, which also should include a large amount of MySQL.

What is this project not! This project is not meant as a replacement for jtv/libpqxx but rather to work with PQXX where QueryC++ will make it easy to build your queries and PQXX will make it easy to connect to and execute your queries in a PostgreSQL database.

./Lars