From: Dagfinn Ilmari Mannsåker Date: Thu, 13 Mar 2008 20:22:34 +0000 (+0000) Subject: Fix limiting table list to the specified schema for DB2 X-Git-Tag: 0.04999_05~14 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=072d5aae0d2a53b1a6d5bac18dbeac3a5b3d61c2;p=dbsrgits%2FDBIx-Class-Schema-Loader.git Fix limiting table list to the specified schema for DB2 --- diff --git a/Changes b/Changes index e2bca21..b8eae02 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,8 @@ Revision history for Perl extension DBIx::Class::Schema::Loader +Not yet released + - Fix limiting table list to the specified schema for DB2 + 0.04999_04 Wed Mar 12, 2008 - Add is_auto_increment detecton for DB2 diff --git a/lib/DBIx/Class/Schema/Loader/DBI/DB2.pm b/lib/DBIx/Class/Schema/Loader/DBI/DB2.pm index 75b59b6..01fbd1c 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/DB2.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/DB2.pm @@ -59,9 +59,18 @@ sub _table_uniq_info { return \@uniqs; } -sub _tables_list { +# DBD::DB2 doesn't follow the DBI API for ->tables +sub _tables_list { my $self = shift; - return map lc, $self->next::method; + + my $dbh = $self->schema->storage->dbh; + my @tables = map { lc } $dbh->tables( + $self->db_schema ? { TABLE_SCHEM => $self->db_schema } : undef + ); + s/\Q$self->{_quoter}\E//g for @tables; + s/^.*\Q$self->{_namesep}\E// for @tables; + + return @tables; } sub _table_pk_info {