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('DB');
18 __PACKAGE__->connection('dbi:...', 'user', 'pass', \%attrs);
20 package MyDB::MyTable;
23 __PACKAGE__->load_components('Table');
27 This class provides a simple way of specifying a database connection.
35 __PACKAGE__->mk_classdata('storage');
39 __PACKAGE__->connection($dsn, $user, $pass, $attrs);
41 Specifies the arguments that will be passed to DBI->connect(...) to
42 instantiate the class dbh when required.
47 my ($class, @info) = @_;
48 my $storage = DBIx::Class::Storage::DBI->new;
49 $storage->connect_info(\@info);
50 $class->storage($storage);
57 Issues a commit again the current dbh
61 sub dbi_commit { $_[0]->storage->commit; }
67 Issues a rollback again the current dbh
71 sub dbi_rollback { $_[0]->storage->rollback; }
79 Matt S. Trout <perl-stuff@trout.me.uk>
83 You may distribute this code under the same terms as Perl itself.