[CDBI] class::dbi::loader and transaction

James. L perlwle at yahoo.com
Tue Nov 21 15:53:48 GMT 2006


hello,

i am new to class::dbi and using class::dbi::loader
for simple db stuff. i read the cdbi page about
transaction and it mention that with:

  Music::DBI->do_transaction( sub {
    my $artist = Music::Artist->insert({ name => 'Pink
Floyd' });
    my $cd = $artist->add_to_cds({ 
      title => 'Dark Side Of The Moon', 
      year => 1974,
    });
  });

package Music::DBI;
  use base 'Class::DBI';
  Music::DBI->connection('dbi:mysql:dbname',
'username', 'password');

what i have in class::dbi::loader is that i am
operating on two tables and if the last action failed,
roll back all the changes. in do_transaction, i can
only pass a particular table class but it won't roll
back the changes on other tables when failed. 

I guess that i need a base class like Music::DBI or
something? 

James.





 
____________________________________________________________________________________
Sponsored Link

Mortgage rates near 39yr lows. 
$310k for $999/mo. Calculate new payment! 
www.LowerMyBills.com/lre



More information about the ClassDBI mailing list