libpqxx 7.7.0: lots of new features, lots of fixes.
It's going to be a big one. Believe me, I toyed with the idea of calling it 8.0. But I think it's not quite radical enough for that. I'm still hoping to raise the language baseline to C++20 for libpqxx 8.0. We'll see.
But here's what you get:
This version introduces a new class, connecting
, for connecting to the database asynchronously. It's not native C++ async support, and it's not based on coroutines, but you can build coroutines on top of it. Kirit Sælensminde has built a sample project for this..
You can now convert SQL range
values to and from C++ strings, using the new pqxx::range
class.
There is now also support for converting between SQL timestamps (without time zones) and C++ std::chrono::year_month_day
values. It's pretty limited, because there are lots of inherent problems with date/time support. For one, it only works with the ISO date format.
If you want fast access to a result's fields without having to go through row
objects, the pqxx::result
class now has a two-dimensional at()
member that takes a row number and a column number. And since there's a proposal for permitting two-dimensional array indexing in C++23, there's a provisional two-dimensional operator[]
as well. (However I can't test this yet, so it could be broken.)
The project now has a file requirements.json
which lists the minimum major versions of compilers, C++, and PostgreSQL that you need for the current version of libpqxx. It's not going to be too detailed, because the more detail I put in there, the more is going to go wrong in maintenance. But at least it should be easy to see in the future which libpqxx versions require which C++ versions etc.
The Doxygen documentation now uses the (Doxygen-extended) Markdown format. That should make the documentation comments in the libpqxx headers a little more modern and easier to read.
Also, we now build docs in doc/html/
, no longer in doc/html/Reference/
.
There are also some changes that may affect you without exactly creating serious incompatibilities. More functions are [[nodiscard]]
. Some member functions are now lvalue-qualified or rvalue-qualified. You can't call an lvalue-qualified function on an rvalue object — so I lvalue-qualified some functions that sane code would not call as the last operation on an object. I also rvalue-qualified one member function that effectively invalidates its object.
Finally, I promised you a lot of fixes:
- Fix
stream_to
for differing table/client encodings. (#473) - Use
[[likely]]
&[[unlikely]]
only in C++20, to silence warnings. - Fix clang "not a const expression" error in Windows. (#472)
- Fix warnings about
[[likely]]
inif constexpr
. (#475) - Clearer error for ambiguous string conversion of
char
type. (#481) - Statement name in
prepare()
error was for the wrong statement. (#488) - Helper for implementing string traits:
generic_to_buf
. - Work around broken
std::filesystem::path
in MinGW. (#498) - Fix leak when getting client encoding fails. (#500)
- Re-enable pyflakes testing in
tools/lint
. - Don't run clang-tidy by default. Compatibility issues with gcc options.
- Disable some
std::filesystem
features on Windows. - Shut up stupid Visual Studio warnings.
- On gcc, mark rarely-used functions as "cold," to be optimised for size.
- Glyph scanning for GB18030 encoding was utterly broken. (#517)
Did I promise too much? Hope you all have a great 2022!