Hi!

I've read on the group that Sequel does not support explicit 
begin/commit/rollback because it would lead to an unsafe API. I partly 
agree with that.

Still, I have a situation where I need start a transaction in a 
`before(:each)` and rollback it in a `after(:each)`, in RSpec. I ended up 
doing the following monkey patch:

module Sequel
  class Database

    def ext_start_transaction(opts=OPTS)
      synchronize(opts[:server]){|conn|
        add_transaction(conn, opts)
        begin_transaction(conn, opts)
      }
    end

    def ext_rollback_transaction(opts=OPTS)
      synchronize(opts[:server]){|conn|
        rollback_transaction(conn, opts)
        remove_transaction(conn, false)
      }
    end

  end
end

Does any one know a cleaner solution that this?

Thanks,
Bernard

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to