1 package DBIx::Class::DB;
3 use base qw/Class::Data::Inheritable/;
4 use DBIx::Class::Storage::DBI;
9 DBIx::Class::DB - Simple DBIx::Class Database connection by class inheritance
15 use base qw/DBIx::Class/;
16 __PACKAGE__->load_components('Core');
18 __PACKAGE__->connection('dbi:...', 'user', 'pass', \%attrs);
20 package MyDB::MyTable;
28 This class provides a simple way of specifying a database connection.
36 __PACKAGE__->mk_classdata('storage');
40 __PACKAGE__->connection($dsn, $user, $pass, $attrs);
42 Specifies the arguments that will be passed to DBI->connect(...) to
43 instantiate the class dbh when required.
48 my ($class, @info) = @_;
49 my $storage = DBIx::Class::Storage::DBI->new;
50 $storage->connect_info(\@info);
51 $class->storage($storage);
58 Issues a commit again the current dbh
62 sub dbi_commit { $_[0]->storage->commit; }
68 Issues a rollback again the current dbh
72 sub dbi_rollback { $_[0]->storage->rollback; }
80 Matt S. Trout <perl-stuff@trout.me.uk>
84 You may distribute this code under the same terms as Perl itself.