X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSchema%2FLoader%2FDBI%2FODBC%2FACCESS.pm;h=17cc808cb7ce7d185ef7bb59be44e9263d9614e7;hb=c4a69b87bd3d3fdda08f05d363311a6e9d3fc0f7;hp=cfaa902f23e763614a4550a905f7ad0298446359;hpb=a47e6e743dfce14a61c2f2c4d5214d88c1c35b36;p=dbsrgits%2FDBIx-Class-Schema-Loader.git diff --git a/lib/DBIx/Class/Schema/Loader/DBI/ODBC/ACCESS.pm b/lib/DBIx/Class/Schema/Loader/DBI/ODBC/ACCESS.pm index cfaa902..17cc808 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/ODBC/ACCESS.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/ODBC/ACCESS.pm @@ -6,9 +6,9 @@ use base qw/ DBIx::Class::Schema::Loader::DBI::ODBC /; use mro 'c3'; -use Carp::Clan qw/^DBIx::Class/; use Try::Tiny; use namespace::clean; +use DBIx::Class::Schema::Loader::Table (); our $VERSION = '0.07010'; @@ -28,6 +28,8 @@ See L for usage information. =cut +sub _supports_db_schema { 0 } + sub _db_path { my $self = shift; @@ -163,7 +165,7 @@ sub _adox_column { my $col_obj; - my $cols = $self->_adox_catalog->Tables->Item($table)->Columns; + my $cols = $self->_adox_catalog->Tables->Item($table->name)->Columns; for my $col_idx (0..$cols->Count-1) { $col_obj = $cols->Item($col_idx); @@ -197,7 +199,7 @@ sub _table_pk_info { my @keydata; my $indexes = try { - $self->_adox_catalog->Tables->Item($table)->Indexes + $self->_adox_catalog->Tables->Item($table->name)->Indexes } catch { warn "Could not retrieve indexes in table '$table', disabling primary key detection: $_\n"; @@ -228,7 +230,7 @@ sub _table_fk_info { return [] if $self->_disable_fk_detection; my $keys = try { - $self->_adox_catalog->Tables->Item($table)->Keys; + $self->_adox_catalog->Tables->Item($table->name)->Keys; } catch { warn "Could not retrieve keys in table '$table', disabling relationship detection: $_\n"; @@ -243,25 +245,32 @@ sub _table_fk_info { my @rels; for my $key_idx (0..($keys->Count-1)) { - my $key = $keys->Item($key_idx); - if ($key->Type == 2) { + my $key = $keys->Item($key_idx); + + next unless $key->Type == 2; + my $local_cols = $key->Columns; my $remote_table = $key->RelatedTable; my (@local_cols, @remote_cols); for my $col_idx (0..$local_cols->Count-1) { - my $col = $local_cols->Item($col_idx); - push @local_cols, $self->_lc($col->Name); - push @remote_cols, $self->_lc($col->RelatedColumn); + my $col = $local_cols->Item($col_idx); + push @local_cols, $self->_lc($col->Name); + push @remote_cols, $self->_lc($col->RelatedColumn); } push @rels, { local_columns => \@local_cols, remote_columns => \@remote_cols, - remote_table => $remote_table, + remote_table => DBIx::Class::Schema::Loader::Table->new( + loader => $self, + name => $remote_table, + ($self->db_schema ? ( + schema => $self->db_schema->[0], + ignore_schema => 1, + ) : ()), + ), }; - - } } return \@rels;