Re: Database Transactions



Andreas Schwarz wrote:
> listrecv wrote:
>> ActiveRecord's standard procedure for transactions is to send a
>> block, and throw an exception to roll it back (
>>
http://api.rubyonrails.com/classes/ActiveRecord/Transactions/ClassMethods.html
>> ). I found this rather uncomfortable. I'd like to be able to begin
>> transactions, commit them, or roll them back from within (fairly)
>> complex control structures - and having to do everything within a
>> block, with one way out, is no good.
>
> You can start/commit/rollback transactions manually
> (ActiveRecord::Base.connection.start_transaction, IIRC). Though I
> don't see why using a block should be a problem for your control
> structure.

+1

Using the block is definitely superior and less error prone. Hint: you
can call methods from the block. :-)

Kind regards

robert

.



Relevant Pages

  • Database Transactions
    ... ActiveRecord's standard procedure for transactions is to send a block, ... and throw an exception to roll it back ( ... transactions, commit them, or roll them back from within ...
    (comp.lang.ruby)
  • Re: Database Transactions
    ... > ActiveRecord's standard procedure for transactions is to send a block, ... > and throw an exception to roll it back ( ... > transactions, commit them, or roll them back from within ...
    (comp.lang.ruby)
  • Re: Begin/Commit Transactions
    ... transactions only apply to your processing code. ... or even at the end if the run if the balance is incorrect, ... there is NOT a way to roll that back. ... It would be great feature if you could wrap all user editing ...
    (microsoft.public.access.forms)
  • Re: JDBC Competitors?
    ... > The paradigm here is persistent objects, with transactions so you can ... > roll them back to a previous state if you don't complete a ...
    (comp.lang.java.databases)
  • Re: Update a Table using transactions
    ... thks, but i have 2 tables with lots of fields, and doing a Store procedure ... > acceptchanges is called and the rowstates of all the rows in the first ... > concurrency exception and the rowstates are changed? ... > procs and implementing your transactions on the back end. ...
    (microsoft.public.dotnet.framework.adonet)