On 10/16/05 5:24 PM, Aaron Ross wrote:
> Is there a way to find the set of Relationship(s?) that refer to a given
> column from a Metadata object?
> 
> Clearly the information is in column_map, but I don't see a method to
> retrieve relationships based on columns rather than relationship names.
> 
> I'm hoping to do something like this:
> 
>   for ( $rose_db_object->columns() ) {
> if ( $rose_db_object->relationships_by_column( $_ ) ) {
> .. do one thing ...
> }
> else {
> ... do another thing ...
> }
>   }

I could add a relationships_by_column() method, but it'd just end up doing
what you'd have to do manually now.  That is, something like:

sub relationships_by_column
{
  my($self, $col_name) = @_;

  my @rels;

  foreach my $rel ($self->relationships)
  {
    next  unless($rel->can('column_map');
    my $col_map = $rel->column_map or next;
    push(@rels, $rel)  if($col_map->{$col_name});
  }

  return wantarray ? @rels : [EMAIL PROTECTED];
}

But my question is, what are you doing that has to differ between columns
that are included as part of a relationship column map and those that
aren't?  IOW, what are "do one thing" and "do another thing" in your
example?

-John






-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to