Fixup for count
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / ResultSourceProxy.pm
1 package # hide from PAUSE 
2     DBIx::Class::ResultSourceProxy;
3
4 use strict;
5 use warnings;
6
7 use base qw/DBIx::Class/;
8
9 sub iterator_class  { shift->result_source_instance->resultset_class(@_) }
10 sub resultset_class { shift->result_source_instance->resultset_class(@_) }
11
12 sub resultset_attributes {
13   shift->result_source_instance->resultset_attributes(@_);
14 }
15
16 sub add_columns {
17   my ($class, @cols) = @_;
18   my $source = $class->result_source_instance;
19   $source->add_columns(@cols);
20   foreach my $c (grep { !ref } @cols) {
21     $class->register_column($c => $source->column_info($c));
22   }
23 }
24
25 sub has_column {                                                                
26   my ($self, $column) = @_;                                                     
27   return $self->result_source_instance->has_column($column);                    
28 }
29
30 sub column_info {                                                               
31   my ($self, $column) = @_;                                                     
32   return $self->result_source_instance->column_info($column);                   
33 }
34
35                                                                                 
36 sub columns {                                                                   
37   return shift->result_source_instance->columns(@_);                            
38 }                                                                               
39                                                                                 
40 sub set_primary_key { shift->result_source_instance->set_primary_key(@_); }     
41 sub primary_columns { shift->result_source_instance->primary_columns(@_); }
42
43 sub add_unique_constraint { shift->result_source_instance->add_unique_constraint(@_); }     
44 sub unique_constraints { shift->result_source_instance->unique_constraints(@_); }
45
46 sub add_relationship {
47   my ($class, $rel, @rest) = @_;
48   my $source = $class->result_source_instance;
49   $source->add_relationship($rel => @rest);
50   $class->register_relationship($rel => $source->relationship_info($rel));
51 }
52
53 sub relationships {
54   shift->result_source_instance->relationships(@_);
55 }
56
57 sub relationship_info {
58   shift->result_source_instance->relationship_info(@_);
59 }
60
61 1;