def transaction
    check_closed

    raise ArgumentError.new("Transaction block not given") unless block_given?
    tx = Transaction.send :new, @conn
    ac = @conn.get_auto_commit
    status = :unknown
    begin
      @conn.set_auto_commit false
      yield tx
      @conn.commit
      status = :committed
    rescue Transaction::Commit
      status = :committed
    rescue Transaction::Rollback
      status = :rolledback
    ensure
      @conn.rollback if status == :unknown && @conn.get_auto_commit == false
      @conn.set_auto_commit ac
    end
    status == :committed
  end
def transaction
    check_closed

    raise ArgumentError.new("Transaction block not given") unless block_given?
    tx = Transaction.send :new, @conn
    ac = @conn.get_auto_commit
    status = :unknown
    begin
      @conn.set_auto_commit false
      yield tx
      @conn.commit
      status = :committed
    rescue Transaction::Commit
      status = :committed
    rescue Transaction::Rollback
      status = :rolledback
    ensure
      @conn.rollback if status == :unknown && @conn.get_auto_commit == false
      @conn.set_auto_commit ac
    end
    status == :committed
  end
Executes the given code block as a transaction. Returns true if the transaction is committed.
 A transaction object is passed to the block, which only has commit and rollback methods.
 The execution breaks out of the code block when either of the methods is called.
 @yield [JDBCHelper::Connection::Transaction] Responds to commit and rollback.
 @return [Boolean] True if committed