Changeset 13 in bookmarks


Ignore:
Timestamp:
01/19/13 17:16:14 (12 years ago)
Author:
peter
Message:
  • the list of bookmarks accepts limit and offset parameters
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/BookmarkApp.pm

    r9 r13  
    7070    my $format = $q->param('format') || 'html'; 
    7171    my $tag = $q->param('tag'); 
    72     my @resources = $bookmarks->get_resources({ tag => $tag }); 
     72    my $limit = $q->param('limit'); 
     73    my $offset = $q->param('offset'); 
     74    my @resources = $bookmarks->get_resources({ 
     75        tag    => $tag, 
     76        limit  => $limit, 
     77        offset => $offset, 
     78    }); 
    7379    my @all_tags = $bookmarks->get_tags({ selected => $tag }); 
    7480    my @cotags = $bookmarks->get_cotags({ tag => $tag }); 
  • trunk/Bookmarks.pm

    r9 r13  
    3838    my $tag = $params->{tag}; 
    3939    my $limit = $params->{limit}; 
     40    my $offset = $params->{offset}; 
    4041 
    4142    my ($sql, @bind) = sql_interp( 
     
    4344        ($tag   ? ('join tags on resources.uri = tags.uri where tags.tag =', \$tag) : ''), 
    4445        'order by ctime desc', 
    45         ($limit ? ('limit', \$limit) : ''), 
     46        ($limit ? ('limit', \$limit) : ()), 
     47        # an offset is only allowed if we have a limit clause 
     48        ($limit && $offset ? ('offset', \$offset) : ()), 
    4649    ); 
    4750 
Note: See TracChangeset for help on using the changeset viewer.