X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSchema%2FLoader%2FDBI.pm;h=191c1d0944e123891274ea5eefd4c1df0f4cb6f0;hb=5ffed88caa6bfe0053af34e8e7f64ec6782257a8;hp=9a462075c5921778fb542f9fa156b1beed0a135e;hpb=3bc7d4f83ea843f6b433d4b32aa15d3bae8ca240;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 9a46207..191c1d0 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI.pm @@ -333,6 +333,14 @@ FROM @{[ $comments_table->sql_name ]} WHERE table_name = @{[ $self->dbh->quote($table->name) ]} EOF + # Failback: try the REMARKS column on table_info + my $dbh = $self->dbh; + if (!$comment && $dbh->can('table_info')) { + my $sth = $self->_dbh_table_info( $dbh, undef, $table->schema, $table->name ); + my $info = $sth->fetchrow_hashref(); + $comment = $info->{REMARKS}; + } + return $comment; } @@ -348,7 +356,15 @@ FROM @{[ $comments_table->sql_name ]} WHERE table_name = @{[ $self->dbh->quote($table->name) ]} AND column_name = @{[ $self->dbh->quote($column_name) ]} EOF - + + # Failback: try the REMARKS column on column_info + my $dbh = $self->dbh; + if (!$comment && $dbh->can('column_info')) { + my $sth = $self->_dbh_column_info( $dbh, undef, $table->schema, $table->name, $column_name ); + my $info = $sth->fetchrow_hashref(); + $comment = $info->{REMARKS}; + } + return $comment; } @@ -516,6 +532,13 @@ sub _dbh_type_info_type_name { # do not use this, override _columns_info_for instead sub _extra_column_info {} +# override to mask warnings if needed +sub _dbh_table_info { + my ($self, $dbh) = (shift, shift); + + return $dbh->table_info(@_); +} + # override to mask warnings if needed (see mysql) sub _dbh_column_info { my ($self, $dbh) = (shift, shift);