cvs commit: p5ee/App-Repository/lib/App/ValueDomain RepositoryTableColumns.pm

[email protected] (Stephen Adkins)
Newsgroups perl.cvs.p5ee
Message-ID <[email protected]>
cvsuser     05/10/20 13:04:24

  Modified:    App-Repository/lib/App/ValueDomain RepositoryTableColumns.pm
  Log:
  able to distinguish between key columns and non-key columns
  
  Revision  Changes    Path
  1.2       +16 -2     p5ee/App-Repository/lib/App/ValueDomain/RepositoryTableColumns.pm
  
  Index: RepositoryTableColumns.pm
  ===================================================================
  RCS file: /cvs/public/p5ee/App-Repository/lib/App/ValueDomain/RepositoryTableColumns.pm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RepositoryTableColumns.pm	12 Oct 2005 14:03:22 -0000	1.1
  +++ RepositoryTableColumns.pm	20 Oct 2005 20:04:24 -0000	1.2
  @@ -76,10 +76,24 @@
       my $table = $self->{table} || die "No table specified in $self->{name} ValueDomain";
       my $values = $rep->get_column_names($table);
       my $labels = $rep->get_column_labels($table);
  -    $labels = { %$labels };
  +    $values = [ @$values ];    # make a copy
  +    $labels = { %$labels };    # make a copy
       if ($self->{sort}) {
           @$values = sort { $labels->{$a} cmp $labels->{$b} } @$values;
       }
  +print STDERR "iskey=[$self->{is_key}]\n";
  +    if (defined $self->{is_key}) {
  +        my $is_key = $self->{is_key};
  +        my @values = ();
  +        my $column_defs = $rep->{table}{$table}{column};
  +        foreach my $col (@$values) {
  +            if (($is_key && $column_defs->{$col}{is_key}) ||
  +                (!$is_key && !$column_defs->{$col}{is_key})) {
  +                push(@values, $col);
  +            }
  +        }
  +        $values = \@values;
  +    }
       $self->{values} = $values;
       $self->{labels} = $labels;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.