Skip to content

Smaller, modernised, all-C++11 libpqxx

Compare
Choose a tag to compare
@jtv jtv released this 25 Dec 11:29
· 1912 commits to master since this release

This is a major overhaul. Changes are everywhere:

  • C++11 is now required. Your compiler must have shared_ptr, noexcept, etc.
  • Removed configure.ac.in; we now use configure.ac directly.
  • Removed pqxx::items. Use the new C++11 initialiser syntax.
  • Removed maketemporary. We weren't using it.
  • Can now be built outside the source tree.
  • New, simpler, lambda-friendly transactor framework.
  • New, simpler, prepared statements and parameterised statements.
  • Result rows can be passed around independently.
  • New exec0(): perform query, expect zero rows of data.
  • New exec1(): perform query, expect (and return) a single row of data.
  • New exec_n(): perform query, expect exactly n rows of data.
  • No longer defines Visual Studio's NOMINMAX in headers.
  • Much faster configure script.
  • Most configuration items are gone.
  • Retired all existing capability flags.
  • Uses WSAPoll() on Windows.
  • Documentation on readthedocs.org, thanks Tim Sheerman-Chase.

Most old code should still compile against the new library, but you may find incompatibilities in uncommon usage.

Everything is more modern now. The code lives on GitHub (with automated test runs thanks to CircleCI), and documentation on ReadTheDocs. Release procedures were rigid and cumbersome and kept me from doing any releases at all; now they're light and fast again. I couldn't get access to the mailing lists, so I dropped them. A lot of workarounds for old compilers and postgres versions went out the window. As a result, the configure script runs in about as many seconds as it used to take minutes!

Adding exec1() functions (to execute a query that returns exactly 1 row) may seem like trivia. But it's actually a big deal. Everything had to move and change in very painful ways in order to make that possible! A row object now keeps its result object alive, so you no longer need a result somewhere in order to have a row variable. The same thing happened between fields and rows. The side effect is that the library is now cleaner, and easier to reason about. To me, looking at the inside, it's like the whole library is new again.

For you, I hope it will mainly be simpler. There's less crud. Prepared statements and parameterised statements no longer look like a clever hack. Builds are faster. It's harder to make subtle mistakes.