code: public void transact(final DbCodeTx code) {
      if (io.vertx.core.Context.isOnEventLoopThread()) {
        throw new DatabaseException("Do not call transact() from event loop threads; use transactAsync() instead");
      }
  
      Transaction tx = new TransactionImpl();
      tx.setRollbackOnError(true);
      tx.setRollbackOnly(false);
      boolean complete = false;
      try {
        code.run(this, tx);
        complete = true;
      } catch (ThreadDeath | DatabaseException t) {
        throw t;
      } catch (Throwable t) {
        throw new DatabaseException("Error during transaction", t);
      } finally {
        if ((!complete && tx.isRollbackOnError()) || tx.isRollbackOnly()) {
          rollbackAndClose();
        } else {
          commitAndClose();
        }
      }
    }
docs: Same as {@link #transact(DbCode)}, but your code block can explicitly
  manage the behavior of the transaction.