X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSchema.pm;h=cbcddbcf01747473b8e3fb8e737e3ccce90b5b72;hb=64cdad22d9b4022de379ae43174c15ce8dc81b59;hp=c3ce0e650593e74b61af7fb7de6bd71e5d8837c2;hpb=106d5f3b7e03a68fb2e125772e3f06a34115f22d;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/lib/DBIx/Class/Schema.pm b/lib/DBIx/Class/Schema.pm index c3ce0e6..cbcddbc 100644 --- a/lib/DBIx/Class/Schema.pm +++ b/lib/DBIx/Class/Schema.pm @@ -637,9 +637,9 @@ sub setup_connection_class { =over 4 -=item Arguments: $storage_type|[$storage_type, \%args] +=item Arguments: $storage_type|{$storage_type, \%args} -=item Return Value: $storage_type|[$storage_type, \%args] +=item Return Value: $storage_type|{$storage_type, \%args} =back @@ -655,8 +655,10 @@ C<::DBI::Sybase::MSSQL>. If your storage type requires instantiation arguments, those are defined as a second argument in the form of a hashref and the entire value needs to be -wrapped into an arrayref. See L for an -example of this. +wrapped into an arrayref or a hashref. We support both types of refs here in +order to play nice with your Config::[class] or your choice. + +See L for an example of this. =head2 connection @@ -682,7 +684,7 @@ sub connection { return $self if !@info && $self->storage; my ($storage_class, $args) = ref $self->storage_type ? - (@{$self->storage_type},{}) : ($self->storage_type, {}); + ($self->_normalize_storage_type($self->storage_type),{}) : ($self->storage_type, {}); $storage_class = 'DBIx::Class::Storage'.$storage_class if $storage_class =~ m/^::/; @@ -696,6 +698,17 @@ sub connection { return $self; } +sub _normalize_storage_type { + my ($self, $storage_type) = @_; + if(ref $storage_type eq 'ARRAY') { + return @$storage_type; + } elsif(ref $storage_type eq 'HASH') { + return %$storage_type; + } else { + $self->throw_exception('Unsupported REFTYPE given: '. ref $storage_type); + } +} + =head2 connect =over 4 @@ -1036,7 +1049,9 @@ produced include a DROP TABLE statement for each table created. Additionally, the DBIx::Class parser accepts a C parameter as a hash ref or an array ref, containing a list of source to deploy. If present, then -only the sources listed will get deployed. +only the sources listed will get deployed. Furthermore, you can use the +C parser parameter to prevent the parser from creating an index for each +FK. =cut @@ -1090,6 +1105,8 @@ override this method in your schema if you would like a different file name format. For the ALTER file, the same format is used, replacing $version in the name with "$preversion-$version". +See L for details of $sqlt_args. + If no arguments are passed, then the following default values are used: =over 4