Changeset 82 in bookmarks


Ignore:
Timestamp:
06/03/15 17:13:52 (9 years ago)
Author:
peter
Message:

issue #8: added notes about deleting bookmarks

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/TODO

    r77 r82  
    1717    $ bkmk stop 
    1818    # stops the running server 
     19 
     20Deleting bookmarks 
     21 
     22    sub delete { 
     23        my $self = shift; 
     24        my $bookmark = shift; 
     25 
     26        my $sth_insert = $self->dbh->prepare('insert into deleted_bookmarks (id, dtime) values (?, ?)'); 
     27        $sth_insert->execute($bookmark->id, time); 
     28        my $sth_delete = $self->dbh->prepare('delete from bookmarks where id = ?'); 
     29        $sth_delete->execute($bookmark->id); 
     30    } 
     31 
     32Paging of results (will require counting bookmark total) 
     33 
     34    sub get_count { 
     35        my $self = shift; 
     36        my $search = shift; 
     37 
     38        my ($sql, @bind) = sql_interp( 
     39            'select count(*) from resources join bookmarks on resources.uri = bookmarks.uri', 
     40            $self->_sql_where_clause($search), 
     41        ); 
     42        my $sth = $self->dbh->prepare($sql); 
     43        $sth->execute(@bind); 
     44        my ($count) = $sth->fetchrow_array; 
     45        return $count; 
     46    } 
  • trunk/api

    r61 r82  
    3434  Delete a bookmark 
    3535 
     36  -- bookmarks that have been deleted 
     37  create table deleted_bookmarks ( 
     38      id integer, 
     39      dtime integer 
     40  ); 
     41 
     42  insert into deleted_bookmarks (id) values (?)  <-- {id} 
     43  delete from bookmarks where id = ? <-- {id} 
     44 
     45  then a request to /{id} checks the deleted_bookmarks table and issues a 410 (cacheable) if it is in there 
     46 
    3647PUT /{id}/{field} 
    3748  Set a single field of a bookmark 
Note: See TracChangeset for help on using the changeset viewer.