Merge 'trunk' into 'DBIx-Class-current'
Brian Cassidy [Thu, 16 Nov 2006 15:47:06 +0000 (15:47 +0000)]
r14845@Brian (orig r2878):  ash | 2006-11-13 15:48:13 -0400
Seperated out quote tests so that matt can use them for S::A at some point (old
test t/19quotes.t) Also includes two failing tests (quoted order by and
{ select => ['me.*']} attrs).

r14870@Brian (orig r2882):  blblack | 2006-11-15 10:13:44 -0400
fix for rt.cpan.org #22740 (use $^X instead of hardcoded "perl")
r14875@Brian (orig r2887):  castaway | 2006-11-15 10:26:47 -0400
Fix foreign/self example

r14885@Brian (orig r2897):  blblack | 2006-11-15 16:16:14 -0400

Don't blow up if columns_info_for returns useless results

r14893@Brian (orig r2898):  bricas | 2006-11-16 11:42:33 -0400
moving it to -current branch

1  2 
lib/DBIx/Class/ResultSource.pm

@@@ -12,8 -12,7 +12,8 @@@ __PACKAGE__->load_components(qw/Accesso
  
  __PACKAGE__->mk_group_accessors('simple' => qw/_ordered_columns
    _columns _primaries _unique_constraints name resultset_attributes
 -  schema from _relationships column_info_from_storage source_name/);
 +  schema from _relationships column_info_from_storage source_name
 +  source_info/);
  
  __PACKAGE__->mk_group_accessors('component_class' => qw/resultset_class
    result_class/);
@@@ -57,22 -56,14 +57,22 @@@ sub new 
    $new->{_relationships} = { %{$new->{_relationships}||{}} };
    $new->{name} ||= "!!NAME NOT SET!!";
    $new->{_columns_info_loaded} ||= 0;
 -  if(!defined $new->column_info_from_storage) {
 -      $new->{column_info_from_storage} = 1
 -  }
    return $new;
  }
  
  =pod
  
 +=head2 source_info
 +
 +Stores a hashref of per-source metadata.  No specific key names
 +have yet been standardized, the examples below are purely hypothetical
 +and don't actually accomplish anything on their own:
 +
 +  __PACKAGE__->source_info({
 +    "_tablespace" => 'fast_disk_array_3',
 +    "_engine" => 'InnoDB',
 +  });
 +
  =head2 add_columns
  
    $table->add_columns(qw/col1 col2 col3/);
@@@ -211,8 -202,8 +211,8 @@@ sub column_info 
         and $self->schema and $self->storage )
    {
      $self->{_columns_info_loaded}++;
-     my $info;
-     my $lc_info;
+     my $info = {};
+     my $lc_info = {};
      # eval for the case of storage without table
      eval { $info = $self->storage->columns_info_for( $self->from ) };
      unless ($@) {
          $lc_info->{lc $realcol} = $info->{$realcol};
        }
        foreach my $col ( keys %{$self->_columns} ) {
-         $self->_columns->{$col} = { %{ $self->_columns->{$col}}, %{$info->{$col} || $lc_info->{lc $col}} };
+         $self->_columns->{$col} = {
+           %{ $self->_columns->{$col} },
+           %{ $info->{$col} || $lc_info->{lc $col} || {} }
+         };
        }
      }
    }
  
  =head2 column_info_from_storage
  
 -Enables or disables the on-demand automatic loading of the above
 -column metadata from storage as neccesary.  Defaults to true in the
 -current release, but will default to false in future releases starting
 -with 0.08000.  This is *deprecated*, and should not be used.  It will
 -be removed before 1.0.
 +Enables the on-demand automatic loading of the above column
 +metadata from storage as neccesary.  This is *deprecated*, and
 +should not be used.  It will be removed before 1.0.
  
 -  __PACKAGE__->column_info_from_storage(0);
    __PACKAGE__->column_info_from_storage(1);
  
  =head2 columns