From: Anders Borch Date: 2003-06-08T17:15:00+09:00 Subject: Re: [ANN] sql-serialize 0.0.3 Brian Candler wrote: > On Sun, Jun 08, 2003 at 03:13:56PM +0900, Anders Borch wrote: > >>snippet from my code: >> >> def insert (dbi) >> begin >> dbi.do("BEGIN") >> sql_insert (dbi) >> sql_insert_array (dbi) >> sql_insert_hash (dbi) >> sql_insert_assoc (dbi) >> dbi.do("COMMIT") > > > Or you could write: > > dbi.transaction do > sql_insert(dbi) > ... > end > > (which might in future work better; beware that right now ruby-dbi has no > concept of "begin transaction" so it's rather broken in this regard) > > >> rescue DBI::DatabaseError => dbe >> dbi.do("ROLLBACK") >> throw dbe >> end > > > Are you sure that's right??? I think you want to do a rollback for *all* > exceptions. That's one reason why the 'transaction do ... end' model might > be better. uhm... what are you thinking about specifically? > > Regards, > > Brian. > -- dc -e 4dd*od3*dddn1-89danrn10-dan3+ann6*dan*2*an13dn1+dn2-dn3+5*ddan2/9+an13nap