9 # add some rows inside a transaction and commit it
10 # XXX: Is storage->dbh the only way to get a dbh?
11 DBICTest::Artist->storage->dbh->{AutoCommit} = 0;
13 DBICTest::Artist->create( {
15 name => "artist number $_",
18 DBICTest::Artist->dbi_commit;
19 my ($artist) = DBICTest::Artist->find(15);
20 is($artist->name, 'artist number 15', "Commit ok");
22 # repeat the test using AutoCommit = 1 to force the commit
23 DBICTest::Artist->storage->dbh->{AutoCommit} = 0;
25 DBICTest::Artist->create( {
27 name => "artist number $_",
30 DBICTest::Artist->storage->dbh->{AutoCommit} = 1;
31 ($artist) = DBICTest::Artist->find(20);
32 is($artist->name, 'artist number 20', "Commit using AutoCommit ok");
34 # add some rows inside a transaction and roll it back
35 DBICTest::Artist->storage->dbh->{AutoCommit} = 0;
37 DBICTest::Artist->create( {
39 name => "artist number $_",
42 DBICTest::Artist->dbi_rollback;
43 ($artist) = DBICTest::Artist->search( artistid => 25 );
44 is($artist, undef, "Rollback ok");