Keep track of the transaction indicator in ReadyForQuery messages

As witnessed in issue #67, previous to this commit pq was happy to
send a COMMIT in a failed transaction (effectively doing a ROLLBACK),
and return a nil error to the caller.  Although one could quite easily
argue that it's the caller's job to make sure that all queries in the
transaction succeeded, it's not really a good idea to return no error
in this case either.  Improve that by keeping track of whether we're
in a failed transaction (or indeed a transaction at all), and fail
explicitly if the caller tried to commit a failed transaction.  This
should also provide increased robustness over protocol-out-of-sync
problems.

It's a bit ugly to have to do this in every code path where a 'Z' is
expected, but the same is true for e.g. ignoring ParameterStatus
messages.  It would be nice to do better than this, but that's a job
for another day.
Check "command tag" after BEGIN, COMMIT and ROLLBACK

This provides additional security against protocol-out-of-sync
errors.  The parsing of the command tag should be similar to what
libpq does.