Ver Fonte

fix index breaking history

George S. Baugh há 5 anos atrás
pai
commit
8f83cf6a5b
2 ficheiros alterados com 2 adições e 6 exclusões
  1. 1 1
      lib/Trog/Data/FlatFile.pm
  2. 1 5
      lib/Trog/SQLite/TagIndex.pm

+ 1 - 1
lib/Trog/Data/FlatFile.pm

@@ -39,7 +39,7 @@ sub read ($self, $query={}) {
         @index = ("$datastore/$query->{id}");
     } else {
         if (-f 'data/posts.db') {
-            @index = map { "$datastore/$_" } Trog::SQLite::TagIndex::posts_for_tags($query->{limit},@{$query->{tags}})
+            @index = map { "$datastore/$_" } Trog::SQLite::TagIndex::posts_for_tags(@{$query->{tags}})
         }
         @index = $self->_index() unless @index;
     }

+ 1 - 5
lib/Trog/SQLite/TagIndex.pm

@@ -18,13 +18,9 @@ Used to speed up the flat-file data model.
 
 =cut
 
-sub posts_for_tags ($limit=0, @tags) {
+sub posts_for_tags (@tags) {
     my $dbh = _dbh();
     my $clause = @tags ? "WHERE tag IN (".join(',' ,(map {'?'} @tags)).")" : '';
-    if ($limit) {
-        $clause .= "LIMIT ?";
-        push(@tags,$limit);
-    }
     my $rows = $dbh->selectall_arrayref("SELECT id FROM posts $clause",{ Slice => {} }, @tags);
     return () unless ref $rows eq 'ARRAY' && @$rows;
     return map { $_->{id} } @$rows;