Implement SQL transaction support

This allows me to ask the database for a group of SQL statements to be
executed as part of a single transaction.  The first user of this is
the code that gets all messages in a folder: now the SELECT command
that lists messages is in the same transaction as the SELECT commands
that check which message is the current message.

I've tried to expose the SQL transaction model in a way that's
compatible with C++.  Essentially the idea is that you get a
transaction object whenever you start a transaction, and that you can
use that object to control when the transaction ends.

Note that there are different transaction strengths in SQL that are
exposed as various subclasses of transactions.  Make sure to use the
weakest transaction types whenever possible, as SQL transactions can't
nest!
Fix the weak->strong transaction ordering

I had these backwards: we should be able to cast an exclusive
transaction to a deferred transaction, not the other way around.
Implement "mhng-pack"

This replaces the old pack code.  It's essentially the same thing,
just a lot cleaner and a lot safer.  This demonstrates how
transactions nest: libmhng uses a fairly weak transaction to move
messages around, while the pack wrapper uses a big exclusive
transaction to make sure nobody is messing with the database while
this happens (as it's a really fragile operation).