Class: Seasar::DBI::TxInterceptor
- Inherits:
-
Object
- Object
- Seasar::DBI::TxInterceptor
- Defined in:
- lib/seasar/dbi/tx-interceptor.rb
Instance Method Summary collapse
-
#call(invocation) ⇒ Object
-
args 1.
-
-
#initialize ⇒ TxInterceptor
constructor
-
args - none.
-
Constructor Details
#initialize ⇒ TxInterceptor
-
args
-
none
-
28 29 30 |
# File 'lib/seasar/dbi/tx-interceptor.rb', line 28 def initialize @dbh = :di, ::DBI::DatabaseHandle end |
Instance Method Details
#call(invocation) ⇒ Object
-
args
-
Seasar::Aop::MethodInvocation invocation
-
-
return
-
Object
-
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/seasar/dbi/tx-interceptor.rb', line 38 def call(invocation) result = nil @dbh['AutoCommit'] = false begin result = invocation.proceed @dbh.commit rescue s2logger.info(self.class.name){"doing rollback..."} @dbh.rollback s2logger.info(self.class.name){"rollback has occured."} raise ensure @dbh['AutoCommit'] = true end return result end |