/[Frey]/trunk/lib/Frey/DBIC/Browser.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/lib/Frey/DBIC/Browser.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1014 by dpavlin, Sun Jan 25 12:57:28 2009 UTC revision 1015 by dpavlin, Sun Jan 25 15:20:40 2009 UTC
# Line 20  has dsn => ( Line 20  has dsn => (
20          default => 'DBI:mysql:database=reblog;host=127.0.0.1;port=13306',          default => 'DBI:mysql:database=reblog;host=127.0.0.1;port=13306',
21  );  );
22    
23    has table => (
24            is => 'rw',
25            isa => 'Str',
26            required => 1,
27            default => 'Items',
28    );
29    
30    has order_by => (
31            is => 'rw',
32            isa => 'Str',
33            required => 1,
34            default => 'timestamp desc',
35    );
36    
37  has page => (  has page => (
38          is => 'rw',          is => 'rw',
39          isa => 'Int',          isa => 'Int',
# Line 42  sub as_sponge { Line 56  sub as_sponge {
56          eval $code;          eval $code;
57          die $@ if $@;          die $@ if $@;
58    
59          warn "# schema ", $self->dump( $schema );          $schema->storage->debug(1); # XXX dump storage generated SQL
60    
61          my @feeds = $schema->resultset('Feeds')->search(          my $attrs;
62                  undef,  
63                  {          $attrs->{ $_ } = $self->$_ foreach ( grep { $self->$_ } ( qw/page order_by/ ) );
64                          page => $self->page,          warn "# attrs ", $self->dump( $attrs );
65                          order_by => [ 'timestamp desc' ],  
66                  }  
67          );          my $rs = $schema->resultset( $self->table )
68            #       ->search( undef, $attrs )
69                    ->search({
70                            'userdata.label' => 'published',
71                            'userdata.value_numeric' => 1,
72                    }, {
73                            join => [ 'userdata' ],
74                            %$attrs
75                    })
76                    ;
77    
78          my @rows;          my @rows;
79          my @name;          my @name;
80          my $name_pos;          my $name_pos;
81    
82          foreach my $feed ( @feeds ) {          while ( my $feed = $rs->next ) {
83                  my %row = $feed->get_columns;                  my %row = $feed->get_columns;
84    
85                  my @row;                  my @row;
# Line 78  sub as_sponge { Line 101  sub as_sponge {
101          return {          return {
102                  rows => \@rows,                  rows => \@rows,
103                  NAME => \@name,                  NAME => \@name,
104                    total_entries => $rs->pager->total_entries,
105          }          }
106  }  }
107    

Legend:
Removed from v.1014  
changed lines
  Added in v.1015

  ViewVC Help
Powered by ViewVC 1.1.26