X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSchema%2FLoader%2FDBI.pm;h=895769fe7598b1c1eba8ecfdb726664ffbcdbe86;hb=refs%2Ftags%2F0.04999_03;hp=aa99c85b36d20851aabc2c2283188ef48f676a1f;hpb=c39e35077d88eb3c81696032a2e51fdf5cb69eab;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 aa99c85..895769f 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.04002'; +our $VERSION = '0.04999_03'; =head1 NAME @@ -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