Make rollback() and commit() no ops when no transaction is active

Gerrit code is using the construct:

  beginTransaction();
  try {
    insertPatchSetAncestors();
    insertPatchSets();
    updateChange();
    commit();
  } finally {
    rollback();
  }

Because beginTransaction() is optional in Gerrit code base commit()
set autoCommit=true on connection object, causing rollback() to fail
in finally block with:

  Cannot rollback when autoCommit is enabled.

To make rollback and commit operations successful in cases when no
transactions were started, make rollback() and commit() methods no ops
in this case.

Change-Id: I6633c490d4cbdaca5d0d400b1cd3fddb7bb45bad
5 files changed