def process_accounts(conn)
transaction_one = Gda::Transaction.new("accounts1")
transaction_one.isolation_level = Gda::Transaction::ISOLATION_SERIALIZABLE
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)
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)
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)
conn.rollback_transaction(transaction_two)
execute_sql_command(conn, "SELECT * FROM accounts")
end