X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSchema%2FLoader%2FDBI%2FDB2.pm;h=30cb803f49eedd7f53f576a5955e56a507b0ae48;hb=1fa1884903b09903ce89a3814e41bac9e91eea9d;hp=75b59b6b4219d15a2d7813f25841abe0a20b8042;hpb=49f820920be58fd58de3ceb5c109d4da70916eb6;p=dbsrgits%2FDBIx-Class-Schema-Loader.git diff --git a/lib/DBIx/Class/Schema/Loader/DBI/DB2.pm b/lib/DBIx/Class/Schema/Loader/DBI/DB2.pm index 75b59b6..30cb803 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/DB2.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/DB2.pm @@ -6,7 +6,7 @@ use base 'DBIx::Class::Schema::Loader::DBI'; use Carp::Clan qw/^DBIx::Class/; use Class::C3; -our $VERSION = '0.04999_04'; +our $VERSION = '0.04999_13'; =head1 NAME @@ -27,6 +27,15 @@ See L. =cut +sub _setup { + my $self = shift; + + $self->next::method(@_); + + my $dbh = $self->schema->storage->dbh; + $self->{db_schema} ||= $dbh->selectrow_array('VALUES(CURRENT_USER)', {}); +} + sub _table_uniq_info { my ($self, $table) = @_; @@ -59,9 +68,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 { @@ -114,6 +132,15 @@ sub _extra_column_info { L, L, L +=head1 AUTHOR + +See L and L. + +=head1 LICENSE + +This library is free software; you can redistribute it and/or modify it under +the same terms as Perl itself. + =cut 1;