# File libgda/sample/sample.rb, line 76
def process_accounts(conn)
    # Creates first transaction.
    transaction_one = Gda::Transaction.new("accounts1")
    # Changes the isolation level.
    transaction_one.isolation_level = Gda::Transaction::ISOLATION_SERIALIZABLE
    # Links it to connection.
    conn.begin_transaction(transaction_one)

    command = Gda::Command.new("UPDATE accounts SET balance=balance+50 WHERE ref_customer=1",
                               Gda::Command::TYPE_SQL,
                               Gda::Command::OPTION_STOP_ON_ERRORS)
    # Links command to transaction.
    command.transaction = transaction_one
    conn.execute_non_query(command)

    command = Gda::Command.new("UPDATE accounts SET balance=balance-50 WHERE ref_customer=2",
                               Gda::Command::TYPE_SQL,
                               Gda::Command::OPTION_STOP_ON_ERRORS)
    command.transaction = transaction_one
    conn.execute_non_query(command)

    # Makes commit on transaction.
    conn.commit_transaction(transaction_one)

    transaction_two = Gda::Transaction.new("accounts2")
    transaction_two.isolation_level = Gda::Transaction::ISOLATION_SERIALIZABLE
    conn.begin_transaction(transaction_two)

    command = Gda::Command.new("UPDATE accounts SET balance=balance+400 WHERE ref_customer=1",
                               Gda::Command::TYPE_SQL,
                               Gda::Command::OPTION_STOP_ON_ERRORS)
    command.transaction = transaction_two
    conn.execute_non_query(command)

    command = Gda::Command.new("UPDATE accounts SET balance=balance-400 WHERE ref_customer=2",
                               Gda::Command::TYPE_SQL,
                               Gda::Command::OPTION_STOP_ON_ERRORS)
    command.transaction = transaction_two
    conn.execute_non_query(command)

    # Makes rollback on second transaction.
    conn.rollback_transaction(transaction_two)

    execute_sql_command(conn, "SELECT * FROM accounts")
end