libpqxx 7.1.0: A whole new way of querying data
Another big update.
The bad news:
- Any
string_traits<TYPE>::size_buffer()
must now benoexcept
. - There's an extra data member in
nullness
:always_null
. You'll need to implement to give your type full functionality.
The good news: there's a new way of retrieving data from the database! It's faster, it's easier, it includes conversion to a type of your choice. Using transaction::stream
, you can query rows from the database straight into a std::tuple
, and so, into local variables:
for (auto const [id, name] : tx.stream<int, std::string_view>("SELECT id, name FROM item"))
process(id, name);
And in other news...
stream_from
now supports more or less arbitrary queries.- Instead of a tuple of fields, you can pass
stream_to
a container as well. - There is now
to_buf
support for string literals. - Streaming data is now more efficient.
- The table name in
stream_from
is now escaped. - You can now "convert" strings to
std::string_view
. Mind your lifetimes! - A
std::variant
will now convert to string, if its member types do. - If a
stream_from
row fails to convert, you can no longer retry it. from_string(field const &)
now handles null values properly.- Obsolete Windows build docs are gone.
- Added
row::to(std::tuple<...>)
— converts the whole row in one go. - Unified the test suites. We no longer need
test/unit/unit_runner
. - New helper:
strip_t<...>
to remove a type's constness and reference. - Replace some custom templating in CMakeFiles with CMake globs.