/[Frey]/trunk/lib/Frey/CouchAPI.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/CouchAPI.pm

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

revision 1056 by dpavlin, Thu Apr 23 21:24:25 2009 UTC revision 1057 by dpavlin, Thu Apr 23 22:18:46 2009 UTC
# Line 181  L<http://wiki.apache.org/couchdb/HTTP_Do Line 181  L<http://wiki.apache.org/couchdb/HTTP_Do
181                  warn "## database: $database id: $id -> $p ", dump( $arg ),"\n";                  warn "## database: $database id: $id -> $p ", dump( $arg ),"\n";
182    
183    
184                  if ( $id =~ m{_all_docs(\w+)?$} ) {                  if ( $id =~ m{_all_docs(\w*)$} ) {
185    
186                          my $by = $1;                          my $by = $1;
187                          my $offset = 0;                          my $offset = 0;
# Line 191  L<http://wiki.apache.org/couchdb/HTTP_Do Line 191  L<http://wiki.apache.org/couchdb/HTTP_Do
191                          my $total_rows = 0;                          my $total_rows = 0;
192    
193                          my @docs = grep { length $_ } map {                          my @docs = grep { length $_ } map {
194                                  return '' if defined $limit && $total_rows == $limit;  
195                                    if ( $limit > 0 && $total_rows == $limit ) {
196                                            '';
197                                    } else {
198                    
199                                  s{^$path/$database/}{};                                          s{^$path/$database/}{};
                                 return '' if defined $endkey && $_ gt $endkey;  
200    
201                                  if ( $startkey ) {                                          if ( defined $endkey && $_ gt $endkey ) {
202                                          if ( $_ ge $startkey ) {                                                  '';
203                                            } elsif ( $startkey ) {
204                                                    if ( $_ ge $startkey ) {
205                                                            $total_rows++;
206                                                            $_;
207                                                    } else {
208                                                            $offset++;
209                                                            '';
210                                                    }
211                                            } else {
212                                                  $total_rows++;                                                  $total_rows++;
213                                                  $_;                                                  $_;
                                         } else {  
                                                 $offset++;  
                                                 return '';  
214                                          }                                          }
                                 } else {  
                                         $total_rows++;  
                                         $_;  
215                                  }                                  }
216    
217                          } glob( "$path/$database/*" );                          } glob( "$path/$database/*" );
218    
219    
220                          warn "## docs $startkey -> $endkey limit $limit ", dump( @docs ); # if $debug;                          warn "## docs $startkey -> $endkey limit $limit ", dump( @docs ); # if $debug;
221    
222                          $json = {                          $json = {
# Line 250  L<http://wiki.apache.org/couchdb/HTTP_Do Line 256  L<http://wiki.apache.org/couchdb/HTTP_Do
256                                  push @{ $json->{rows} }, $rows->{$id};                                  push @{ $json->{rows} }, $rows->{$id};
257                          }                          }
258    
259                            $status = 200;
260    
261                  } elsif ( $method eq 'PUT' ) {                  } elsif ( $method eq 'PUT' ) {
262                    
263                          warn "## ",dump( $tx->req ); # if $debug;                          warn "## ",dump( $tx->req ); # if $debug;

Legend:
Removed from v.1056  
changed lines
  Added in v.1057

  ViewVC Help
Powered by ViewVC 1.1.26