5 # add some rows inside a transaction and commit it
6 # XXX: Is storage->dbh the only way to get a dbh?
7 DBICTest::Artist->storage->dbh->{AutoCommit} = 0;
9 DBICTest::Artist->create( {
11 name => "artist number $_",
14 DBICTest::Artist->dbi_commit;
15 my ($artist) = DBICTest::Artist->find(15);
16 is($artist->name, 'artist number 15', "Commit ok");
18 # repeat the test using AutoCommit = 1 to force the commit
19 DBICTest::Artist->storage->dbh->{AutoCommit} = 0;
21 DBICTest::Artist->create( {
23 name => "artist number $_",
26 DBICTest::Artist->storage->dbh->{AutoCommit} = 1;
27 ($artist) = DBICTest::Artist->find(20);
28 is($artist->name, 'artist number 20', "Commit using AutoCommit ok");
30 # add some rows inside a transaction and roll it back
31 DBICTest::Artist->storage->dbh->{AutoCommit} = 0;
33 DBICTest::Artist->create( {
35 name => "artist number $_",
38 DBICTest::Artist->dbi_rollback;
39 ($artist) = DBICTest::Artist->search( artistid => 25 );
40 is($artist, undef, "Rollback ok");