[Nitro] Request for Transaction example

Reid Thompson Reid.Thompson at ateb.com
Tue Jun 5 12:53:26 EDT 2007


On Tue, 2007-06-05 at 12:50 -0400, Reid Thompson wrote:
> On Tue, 2007-06-05 at 18:33 +0300, Jonathan Buch wrote:
> > Hi,
> > 
> > store = $og.store
> > conn = store.conn
> > 
> > begin
> > store.start
> > a = User.new; a.name = 'asdf5'; a.save
> > conn.exec %{INSERT INTO oguser ("real_name", "password", "update_time",  
> > "email", "name", "access_time", "time_deleted", "revision", "phone",  
> > "create_time", "phone2", "customer_oid") VALUES (NULL, NULL, NULL, NULL,  
> > 'asdf555', NULL, NULL, NULL, NULL, NULL, NULL, NULL)}
> > rescue Object
> > end
> > 
> > store.rollback
> > 
> > It turned out, that the a.save did end up in the store, while
> > the second one didn't.  What does that tell us?  We're FUCKED!
> > 
> > I didn't take into account that there are 5 stores to choose from,
> > each having his own connection and own transaction.
> > 
> 
> so the default initialization starts 5 connections to the database?
> and we're utilizing 'more than one' in our scenario?

OK -- I think I see...
./lib/og/manager.rb
66:      (options[:connection_count] || 5).times do

> 
> > Yes, disturbing.  If you will excuse me, I think I'm gonna cry. ;/
> > 
> > Jo
> > 
> _______________________________________________
> Nitro-general mailing list
> Nitro-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/nitro-general


More information about the Nitro-general mailing list