def self.test_actiondef self.test_action
transaction do
begin
Project.connection.begin_db_transaction
InfoProject.connection.begin_db_transaction
City.update_all(["name_cn=?", 'dd'], ["id=?", 10003])
ActiveRecord::Base.connection.execute("update cities@pl set name_cn = 'dd' where id = 10003")
raise "aa"
City.update_all(["name_cn=?", 'aa'], ["id=?", 10002])
InfoCity.update_all(["name_cn=?", 'bb'], ["id=?", 10002])
rescue => e
puts e
Project.connection.rollback_db_transaction
InfoProject.connection.rollback_db_transaction
end
end
end
begin
Project.connection.begin_db_transaction
InfoProject.connection.begin_db_transaction
City.update_all(["name_cn=?", 'aa'], ["id=?", 1])
InfoCity.update_all(["name_cn=?", 'bb'], ["id=?", 1])
raise "aa"
City.update_all(["name_cn=?", 'aa'], ["id=?", 2])
InfoCity.update_all(["name_cn=?", 'bb'], ["id=?", 2])
InfoProject.connection.commit_db_transaction
Project.connection.commit_db_transaction
rescue => e
puts e
InfoProject.connection.rollback_db_transaction
Project.connection.rollback_db_transaction
end