X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSchema%2FLoader%2FDBI.pm;h=f27413d3d51d125d36e8d1153ae4d17c1cf22711;hb=41ef22da3417549e4b5eedd025cca17278bd1d72;hp=01d9b2006bc34ea3aff73983c002ea49cd691126;hpb=f1f25439dd968b2f88f6de104f0674df589a6830;p=dbsrgits%2FDBIx-Class-Schema-Loader.git diff --git a/lib/DBIx/Class/Schema/Loader/DBI.pm b/lib/DBIx/Class/Schema/Loader/DBI.pm index 01d9b20..f27413d 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI.pm @@ -7,7 +7,7 @@ use Class::C3; use Carp::Clan qw/^DBIx::Class/; use UNIVERSAL::require; -our $VERSION = '0.04003'; +our $VERSION = '0.04999_06'; =head1 NAME @@ -45,7 +45,7 @@ sub new { croak "Failed to require $subclass: $@"; } elsif(!$@) { - bless $self, "DBIx::Class::Schema::Loader::DBI::${driver}"; + bless $self, $subclass unless $self->isa($subclass); } # Set up the default quoting character and name seperators @@ -169,8 +169,8 @@ sub _table_fk_info { my ($self, $table) = @_; my $dbh = $self->schema->storage->dbh; - my $sth = $dbh->foreign_key_info( '', '', '', '', - $self->db_schema, $table ); + my $sth = $dbh->foreign_key_info( '', $self->db_schema, '', + '', $self->db_schema, $table ); return [] if !$sth; my %rels; @@ -212,7 +212,6 @@ sub _columns_info_for { my %result; eval { my $sth = $dbh->column_info( undef, $self->db_schema, $table, '%' ); - $sth->execute(); while ( my $info = $sth->fetchrow_hashref() ){ my %column_info; $column_info{data_type} = $info->{TYPE_NAME}; @@ -222,7 +221,9 @@ sub _columns_info_for { my $col_name = $info->{COLUMN_NAME}; $col_name =~ s/^\"(.*)\"$/$1/; - $result{$col_name} = \%column_info; + my $extra_info = $self->_extra_column_info($info) || {}; + + $result{$col_name} = { %column_info, %$extra_info }; } $sth->finish; }; @@ -247,7 +248,9 @@ sub _columns_info_for { $column_info{size} = $2; } - $result{$columns[$i]} = \%column_info; + my $extra_info = $self->_extra_column_info($table, $columns[$i], $sth, $i) || {}; + + $result{$columns[$i]} = { %column_info, %$extra_info }; } $sth->finish; @@ -265,6 +268,10 @@ sub _columns_info_for { return \%result; } +# Override this in vendor class to return any additional column +# attributes +sub _extra_column_info {} + =head1 SEE ALSO L