man DBIx::Class::DB () - Simple DBIx::Class Database connection by class inheritance

NAME

DBIx::Class::DB - Simple DBIx::Class Database connection by class inheritance

SYNOPSIS

  package MyDB;

  use base qw/DBIx::Class/;
  __PACKAGE__->load_components('DB');

  __PACKAGE__->connection('dbi:...', 'user', 'pass', \%attrs);

  package MyDB::MyTable;

  use base qw/MyDB/;
  __PACKAGE__->load_components('Core'); # just load this in MyDB if it will always be there

  ...

DESCRIPTION

This class provides a simple way of specifying a database connection.

METHODS

storage

Sets or gets the storage backend. Defaults to DBIx::Class::Storage::DBI.

class_resolver

Sets or gets the class to use for resolving a class. Defaults to DBIx::Class::ClassResolver::Passthrough, which returns whatever you give it. See resolve_class below.

connection

  __PACKAGE__->connection($dsn, $user, $pass, $attrs);

Specifies the arguments that will be passed to DBI->connect(...) to instantiate the class dbh when required.

txn_begin

Begins a transaction (does nothing if AutoCommit is off).

txn_commit

Commits the current transaction.

txn_rollback

Rolls back the current transaction.

AUTHORS

Matt S. Trout <mst@shadowcatsystems.co.uk>

LICENSE

You may distribute this code under the same terms as Perl itself.