X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSchema.pm;h=a7080e29ceb3f61acda9ecb38b143d4a9e5aa8c5;hb=73d47f9f2e278359b095b9986da89988aee83a44;hp=80c43d9bb72eae09d995405a4be83d7a2c7790a5;hpb=1acfef8e202edc99992ee59a8d87d1d72ad8e362;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Schema.pm b/lib/DBIx/Class/Schema.pm index 80c43d9..a7080e2 100644 --- a/lib/DBIx/Class/Schema.pm +++ b/lib/DBIx/Class/Schema.pm @@ -7,9 +7,8 @@ use DBIx::Class::Exception; use Carp::Clan qw/^DBIx::Class/; use Scalar::Util qw/weaken/; use File::Spec; -use MRO::Compat; use Sub::Name (); -require Module::Find; +use Module::Find(); use base qw/DBIx::Class/; @@ -43,7 +42,7 @@ DBIx::Class::Schema - composable schemas $dsn, $user, $password, - { AutoCommit => 0 }, + { AutoCommit => 1 }, ); my $schema2 = Library::Schema->connect($coderef_returning_dbh); @@ -512,7 +511,7 @@ syntax on the C<@connectinfo> argument, or L in general. Note that C expects an arrayref of arguments, but -C does not. C wraps it's arguments in an arrayref +C does not. C wraps its arguments in an arrayref before passing them to C. =head3 Overloading @@ -544,6 +543,8 @@ name. sub resultset { my ($self, $moniker) = @_; + $self->throw_exception('resultset() expects a source name') + unless defined $moniker; return $self->source($moniker)->resultset; } @@ -756,7 +757,7 @@ i.e., [ 2, 'Indie Band' ], ... ]); - + Since wantarray context is basically the same as looping over $rs->create(...) you won't see any performance benefits and in this case the method is more for convenience. Void context sends the column information directly to storage @@ -807,10 +808,10 @@ Overload C to change the behaviour of C. sub connection { my ($self, @info) = @_; return $self if !@info && $self->storage; - + my ($storage_class, $args) = ref $self->storage_type ? ($self->_normalize_storage_type($self->storage_type),{}) : ($self->storage_type, {}); - + $storage_class = 'DBIx::Class::Storage'.$storage_class if $storage_class =~ m/^::/; eval "require ${storage_class};"; @@ -1147,7 +1148,7 @@ sub ddl_filename { $filename =~ s/::/-/g; $filename = File::Spec->catfile($dir, "$filename-$version-$type.sql"); $filename =~ s/$version/$preversion-$version/ if($preversion); - + return $filename; } @@ -1373,7 +1374,7 @@ more information. $self->throw_exception ("No arguments to load_classes and couldn't load ${base} ($@)") if $@; - + if ($self eq $target) { # Pathological case, largely caused by the docs on early C::M::DBIC::Plain foreach my $moniker ($self->sources) { @@ -1386,14 +1387,14 @@ more information. $self->connection(@info); return $self; } - + my $schema = $self->compose_namespace($target, $base); { no strict 'refs'; my $name = join '::', $target, 'schema'; *$name = Sub::Name::subname $name, sub { $schema }; } - + $schema->connection(@info); foreach my $moniker ($schema->sources) { my $source = $schema->source($moniker);