__PACKAGE__->load_components(qw/PK::Auto::Pg Core/); # for example
__PACKAGE__->table('foo');
+ # Elsewhere in your code:
my $schema1 = My::Schema->connect(
$dsn,
$user,
}
my $schema = $self->compose_namespace($target, $base);
+ {
+ no strict 'refs';
+ *{"${target}::schema"} = sub { $schema };
+ }
+
$schema->connection(@info);
foreach my $moniker ($schema->sources) {
my $source = $schema->source($moniker);
}
{
no strict 'refs';
- *{"${target}::schema"} =
- sub { $schema };
foreach my $meth (qw/class source resultset/) {
*{"${target}::${meth}"} =
sub { shift->schema->$meth(@_) };
=cut
-sub connect { shift->clone->connection(@_) };
+sub connect { shift->clone->connection(@_) }
+
+=head2 txn_begin
+
+Begins a transaction (does nothing if AutoCommit is off).
+
+=cut
+
+sub txn_begin { shift->storage->txn_begin }
+
+=head2 txn_commit
+
+Commits the current transaction.
+
+=cut
+
+sub txn_commit { shift->storage->txn_commit }
+
+=head2 txn_rollback
+
+Rolls back the current transaction.
+
+=cut
+
+sub txn_rollback { shift->storage->txn_rollback }
=head2 clone
return $clone;
}
-=item populate($moniker, \@data);
+=head2 populate($moniker, \@data);
Populates the source registered with the given moniker with the supplied data.
@data should be a list of listrefs, the first containing column names, the
}
}
-=item throw_exception
+=head2 throw_exception
Defaults to using Carp::Clan to report errors from user perspective.