Skip Menu |

This queue is for tickets about the Class-DBI-Loader-Oracle CPAN distribution.

Report information
The Basics
Id: 12730
Status: new
Priority: 0/
Queue: Class-DBI-Loader-Oracle

People
Owner: Nobody in particular
Requestors: scottsweep [...] yahoo.com
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: relationships
David, I was able to get relationships working. I used your $user code from the _tables sub and passed that into the DBI API. The case sensitivity gets a little odd between Oracle (wants uppercase) and DBI (returns keys lower case), but the code below sorts it out nicely, most derivered from CLass::DBI::Loader::Generic::_relationships. # Find and setup relationships sub _relationships { my $self = shift; foreach my $table ( $self->tables ) { my $dbh = $self->find_class($table)->db_Main; my $user = uc $self->{_datasource}->[1]; # handle user strings of the form user@sid or user/password@sid # we want only the user (schema) name $user =~ s/^(\w+)[@\/]?.*$/$1/; if (my $sth = $dbh->foreign_key_info( undef, $user, undef , undef, $user, uc($table)) ) { for my $res ( @{ $sth->fetchall_arrayref( {} ) } ) { my $column = lc($res->{FK_COLUMN_NAME} || $res->{fk_column_name}); # these are usually lower case, depending on the DBI/Oracle driver my $other = lc($res->{UK_TABLE_NAME} || $res->{uk_table_name}); eval { $self->_has_a_many( $table, $column, $other ) }; warn qq/has_a_many failed "$@"/ if $@ && $self->debug; } } } }