cvs commit: p5ee/App-Repository/lib/App/Repository DBI.pm

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

  Modified:    App-Repository/lib/App/Repository DBI.pm
  Log:
  _get_default_columns(), table level index hints
  
  Revision  Changes    Path
  1.29      +19 -2     p5ee/App-Repository/lib/App/Repository/DBI.pm
  
  Index: DBI.pm
  ===================================================================
  RCS file: /cvs/public/p5ee/App-Repository/lib/App/Repository/DBI.pm,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- DBI.pm	12 Oct 2005 13:59:36 -0000	1.28
  +++ DBI.pm	20 Oct 2005 20:03:17 -0000	1.29
  @@ -455,6 +455,15 @@
       return($rows);
   }
   
  +sub _get_default_columns {
  +    &App::sub_entry if ($App::trace);
  +    my ($self, $table) = @_;
  +    my $table_def = $self->{table}{$table};
  +    my $columns = $table_def->{default_columns} || $table_def->{phys_columns} || $table_def->{columns};
  +    &App::sub_exit($columns) if ($App::trace);
  +    return($columns);
  +}
  +
   # modified from the DBD::_::db::selectall_arrayref in DBI.pm
   sub _selectrange_arrayref {
       &App::sub_entry if ($App::trace);
  @@ -1295,6 +1304,9 @@
               }
               else {
                   push(@join_conditions, split(/ +and +/,$where_condition)) if ($where_condition);
  +                if ($options->{hint} && $self->{table}{$table}{alias} && $tablealias eq $self->{table}{$table}{alias}) {
  +                    $tableref .= " $options->{hint}";
  +                }
                   push(@from_tables, $tableref);
                   #print "   $tablealias is [$dbtable] as [$tableref] where [$where_condition]\n";
               }
  @@ -1304,6 +1316,9 @@
           $tablealias = $tablealiases->[0];
           $table = $tablealiashref->{$tablealias}{table};
           $tableref = ($table) ? "$table $tablealias" : $tablealias;
  +        if ($options->{hint} && $self->{table}{$table}{alias} && $tablealias eq $self->{table}{$table}{alias}) {
  +            $tableref .= " $options->{hint}";
  +        }
           push(@from_tables, $tableref);
       }
   
  @@ -2340,6 +2355,8 @@
           # if we got a list of columns for the table from the database
           if (defined $phys_columns && ref($phys_columns) eq "ARRAY") {
   
  +            $table_def->{phys_columns} = [ @$phys_columns ];
  +
               for ($colnum = 0; $colnum <= $#$phys_columns; $colnum++) {
                   $column = $phys_columns->[$colnum];
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.