Changeset 76 in bookmarks
- Timestamp:
- 04/11/14 11:29:34 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Bookmarks.pm
r75 r76 247 247 my $mtime = time; 248 248 249 # update the URI, if it has changed 249 250 my $changed_uri = 0; 250 251 my $sth_current = $self->dbh->prepare('select uri from bookmarks where id = ?'); … … 259 260 } 260 261 261 # update the title 262 # TODO: only do this if the title has changed 263 # TODO: should we update mtime if the title changes? 264 my $sth_update = $self->dbh->prepare('update resources set title = ? where uri = ?'); 265 $sth_update->execute($bookmark->title, $bookmark->uri); 266 262 # update the title, if it has changed 263 my $changed_title = 0; 264 my $sth_current_title = $self->dbh->prepare('select title from resources where uri = ?'); 265 $sth_current_title->execute($bookmark->uri); 266 my ($stored_title) = $sth_current_title->fetchrow_array; 267 268 if ($stored_title ne $bookmark->title) { 269 my $sth_update = $self->dbh->prepare('update resources set title = ? where uri = ?'); 270 $sth_update->execute($bookmark->title, $bookmark->uri); 271 $changed_title++; 272 } 273 274 # update the tags, if they have changed 267 275 my $changed_tags = $self->_update_tags($bookmark->uri, $bookmark->tags); 268 276 269 if ($changed_uri or $changed_tags) { 277 # update the mtime, if the bookmark has actually been changed 278 if ($changed_uri or $changed_title or $changed_tags) { 270 279 # update the mtime if the bookmark already existed but the tags were changed 271 280 my $sth_update = $self->dbh->prepare('update bookmarks set mtime = ? where uri = ?');
Note: See TracChangeset
for help on using the changeset viewer.