X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSchema.pm;h=02c48deb28ee982fc32c6479794dcefba6add17a;hb=7e51afbf1951bc8febf00897e5e3f0f25dfc34aa;hp=cf054d0704eba8300fba6b2e76aff1071fcafe85;hpb=c4e67d31ed6f3fb01c07451cdf69c0782bc610a2;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/lib/DBIx/Class/Schema.pm b/lib/DBIx/Class/Schema.pm index cf054d0..02c48de 100644 --- a/lib/DBIx/Class/Schema.pm +++ b/lib/DBIx/Class/Schema.pm @@ -211,7 +211,6 @@ sub load_namespaces { foreach my $result (keys %results) { my $result_class = $results{$result}; $class->ensure_class_loaded($result_class); - $result_class->source_name($result) unless $result_class->source_name; my $rs_class = delete $resultsets{$result}; my $rs_set = $result_class->resultset_class; @@ -226,7 +225,9 @@ sub load_namespaces { $result_class->resultset_class($rs_class); } - push(@to_register, [ $result_class->source_name, $result_class ]); + my $source_name = $result_class->source_name || $result; + + push(@to_register, [ $source_name, $result_class ]); } } @@ -439,6 +440,13 @@ L or L. For an example of what you can do with this, see L. +Note that sqlt_deploy_hook is called by L, which in turn +is called before L. Therefore the hook can be used only to manipulate +the L object before it is turned into SQL fed to the +database. If you want to execute post-deploy statements which can not be generated +by L, the currently suggested method is to overload L +and use L. + =head1 METHODS =head2 connect @@ -572,6 +580,14 @@ See L for more information. This interface is preferred over using the individual methods L, L, and L below. +WARNING: If you are connected with C 0> the transaction is +considered nested, and you will still need to call L to write your +changes when appropriate. You will also want to connect with C +1> to get partial rollback to work, if the storage driver for your database +supports it. + +Connecting with C 1> is recommended. + =cut sub txn_do { @@ -1228,7 +1244,7 @@ sub register_extra_source { sub _register_source { my ($self, $moniker, $source, $params) = @_; - %$source = %{ $source->new( { %$source, source_name => $moniker }) }; + $source = $source->new({ %$source, source_name => $moniker }); my %reg = %{$self->source_registrations}; $reg{$moniker} = $source;