Changeset 9 in bookmarks for trunk/Bookmarks.pm
- Timestamp:
- 03/25/12 15:45:11 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Bookmarks.pm
r7 r9 2 2 3 3 use Class::Accessor 'antlers'; 4 use SQL::Interp qw{:all}; 4 5 use Bookmark; 5 6 … … 36 37 my $params = shift; 37 38 my $tag = $params->{tag}; 38 my $sth_resource; 39 if ($tag) { 40 $sth_resource = $self->dbh->prepare('select * from resources join tags on resources.uri = tags.uri join bookmarks on resources.uri = bookmarks.uri where tags.tag = ? order by ctime desc'); 41 $sth_resource->execute($tag); 42 } else { 43 $sth_resource = $self->dbh->prepare('select * from resources join bookmarks on resources.uri = bookmarks.uri order by ctime desc'); 44 $sth_resource->execute; 45 } 39 my $limit = $params->{limit}; 40 41 my ($sql, @bind) = sql_interp( 42 'select * from resources join bookmarks on resources.uri = bookmarks.uri', 43 ($tag ? ('join tags on resources.uri = tags.uri where tags.tag =', \$tag) : ''), 44 'order by ctime desc', 45 ($limit ? ('limit', \$limit) : ''), 46 ); 47 48 my $sth_resource = $self->dbh->prepare($sql); 49 $sth_resource->execute(@bind); 46 50 47 51 my $sth_tag = $self->dbh->prepare('select tag from tags where uri = ? order by tag');
Note: See TracChangeset
for help on using the changeset viewer.