[Libpqxx-general] libpqxx 3.0 released!

Jeroen Vermeulen jtv at xs4all.nl
Mon Nov 3 06:54:28 UTC 2008


Hi everyone,

The new libpqxx 3.0 is out today.  The full announcement is on 
libpqxx-announce, and of course there's a blurb on http://pqxx.org/

With this release, we're going to try and support binary compatibility 
between x.y.* releases.  So for instance 3.0.1, if we need one, should 
be binary-compatible with 3.0.

There are lots and lots of other improvements that many of you have been 
waiting to see officially released.  The most invasive change is that 
cursors and cachedresults have been replaced with something completely new.

Why?  Because it was just about impossible for the library to keep track 
of an SQL cursor's movement and fake C++ iterator-style semantics on 
top.  SQL cursors have "empty rows" at both the beginning and the end of 
their traversals, whereas C++ iterations only have an empty element at 
the end.  SQL uses pre-increment, C++ supports post-increment. 
Dereferencing an iterator always returns one element, but a cursor 
returns arbitrarily-sized batches.  And last but not least, there's no 
good way to find out whether you're moving a cursor across n rows, or n 
rows plus one empty row at the beginning, or n rows plus one empty row 
at the end, or n rows plus empty rows at either end.  The old cursor 
class tried very hard to make SQL semantics looked like C++ semantics, 
but I never got it quite right.

The new class is way, way simpler.  There is no "current position." 
Position is hidden as an implementation detail.  Instead, you just give 
it the row numbers that define the range that you want.  It makes 
complex cursor code in your program easier to read and maintain, but at 
the same time it was also much easier to implement.  It took me a long 
time of twiddling with intermediate abstraction levels to realize that 
the old approach was just wrong.  I hope you'll find that the change is 
worth the pain of the incompatibility.

What else?  Oh, the test suite has been refurbished, making test 
programs shorter and speeding up the test process.  You can cancel an 
ongoing query in a pipeline, e.g. if it's taking too long. 
Floating-point support has been improved, supporting infinities and 
working harder to preserve precision.  The string conversion system has 
been rewritten, and impossible conversions are now flagged at compile 
time rather than at link time.  There are more exception classes to help 
you tell different kinds of SQL errors apart.  Compatibility with 
different compilers and platforms has improved.  New quote() functions 
in transactions and connections let you escape and quote variables in 
one go (without worrying that a byte that's a quote in ASCII might be 
part of a different character in your encoding).

The list goes on; see the NEWS file for more details.

As always, get your tarballs on http://pqxx.org/ and let me know how it 
works for you.


Jeroen



More information about the Libpqxx-general mailing list