Revision history for DBIx::Class
+ - marked DB.pm as deprecated and noted it will be removed by 1.0
- add ResultSetColumn
- refactor ResultSet code to resolve attrs as late as poss
- merge prefetch attrs into join attrs
SQLT modules so an app can do its own deploy without SQLT on the target
system
+2006-05-25 by mst (TODOed by bluefeet)
+ Add the search attributes "limit" and "rows_per_page".
+ limit: work as expected just like offset does
+ rows_per_page: only be used if you used the page attr or called $rs->page
+ rows: modify to be an alias that gets used to populate either as appropriate,
+ if you haven't specified one of the others
=head1 NAME
-DBIx::Class::DB - Non-recommended classdata schema component
+DBIx::Class::DB - (DEPRECATED) classdata schema component
=head1 SYNOPSIS
This class is designed to support the Class::DBI connection-as-classdata style
for DBIx::Class. You are *strongly* recommended to use a DBIx::Class::Schema
-instead; DBIx::Class::DB will continue to be supported but new development
-will be focused on Schema-based DBIx::Class setups.
+instead; DBIx::Class::DB will not undergo new development and will be moved
+to being a CDBICompat-only component before 1.0.
=head1 METHODS
my $genus = $schema->resultset('Genus')->find(12);
+ my $coderef2 = sub {
+ $genus->extinct(1);
+ $genus->update;
+ };
+
my $coderef1 = sub {
- my ($schema, $genus, $code) = @_;
$genus->add_to_species({ name => 'troglodyte' });
$genus->wings(2);
$genus->update;
- $schema->txn_do($code, $genus); # Can have a nested transaction
+ $schema->txn_do($coderef2); # Can have a nested transaction
return $genus->species;
};
- my $coderef2 = sub {
- my ($genus) = @_;
- $genus->extinct(1);
- $genus->update;
- };
-
my $rs;
eval {
- $rs = $schema->txn_do($coderef1, $schema, $genus, $coderef2);
+ $rs = $schema->txn_do($coderef1);
};
if ($@) { # Transaction failed
For example,
my $author_rs = $schema->resultset('Author')->find(1);
+ my @titles = qw/Night Day It/;
my $coderef = sub {
- my ($author, @titles) = @_;
-
# If any one of these fails, the entire transaction fails
- $author->create_related('books', {
+ $author_rs->create_related('books', {
title => $_
}) foreach (@titles);
my $rs;
eval {
- $rs = $schema->txn_do($coderef, $author_rs, qw/Night Day It/);
+ $rs = $schema->txn_do($coderef);
};
- if ($@) {
- my $error = $@;
- if ($error =~ /Rollback failed/) {
- die "something terrible has happened!";
- } else {
- deal_with_failed_transaction();
- }
+ if ($@) { # Transaction failed
+ die "something terrible has happened!" #
+ if ($@ =~ /Rollback failed/); # Rollback failed
+
+ deal_with_failed_transaction();
}
In a nested transaction (calling txn_do() from within a txn_do() coderef) only
ok($artist2->delete_related('cds', {title => {like => '%'}}));
cmp_ok($schema->resultset('CD')->count, '==', ($total_cds - $artist2_cds), 'too many cds were deleted');
+