github jtv/libpqxx 7.3.1
libpqxx 7.3.1: New "large objects" API

latest releases: 7.9.2, 7.9.1, 7.9.0...
3 years ago

This new release replaces the largeobject class and friends with a single, much simpler blob class. Down with complexity! The new API has no streams; I don't think those stream classes really added much over a basic "write these n bytes" API.

The largeobject hierarchy now has the deprecated attribute, so your compiler may warn you when you use it. A lot of other things that were merely documented as deprecated now have that attribute as well.

In other news: the documentation now describes the concept of "transaction focus." This is how libpqxx enforces rules such as "you can't issue a query on a transaction while there's a pipeline open on that transaction," or "you can't have two table streams open on one transaction at once," or "you can't issue queries on a transaction that currently has an active subtransaction."

The errors themselves also got better: if you give your query a name or description —it's entirely optional— then an error message caused by that query can now actually mention that name. This is of no help when your code is running smoothly, but it can make debugging easier.

I'm also dipping a toe in the water of "named constructors." Some classes, particularly stream_from and the new blob, have too many constructors. Overloading can get a bit finicky, and the differences in meaning are not always very clear.

So for instance instead of just constructing a blob, for instance, and passing a "read-only please" argument, you do it like this:

    auto myblob = pqxx::blob::open_r(mytransaction, blob_id);

And similar for read-write or write-only. There is a new named constructor for stream_from as well, though only for the "stream from query" case. For the "stream from table" case, I'm still looking at the overloading possibilities for the list of columns.

Don't miss a new libpqxx release

NewReleases is sending notifications on new releases.