| 
                Last change
                  on this file since 82 was
                  82,
                  checked in by peter, 10 years ago
           | 
        
        
          | 
               
issue #8: added notes about deleting bookmarks 
 
           | 
        
        | 
            File size:
            1.4 KB
           | 
      
      
        
  | Line |   | 
|---|
| 1 |     - import/export of bookmark data | 
|---|
| 2 |     - tool to scan database for broken URLs | 
|---|
| 3 |     - machine tags | 
|---|
| 4 |     - could this be useful: http://stackoverflow.com/questions/418898/sqlite-upsert-not-insert-or-replace | 
|---|
| 5 |     - suite of tools to init, start, and stop an instance | 
|---|
| 6 |     - better name | 
|---|
| 7 |  | 
|---|
| 8 | Tool suite example to create an instance of the application in the directory "foo": | 
|---|
| 9 |  | 
|---|
| 10 |     $ mkdir foo | 
|---|
| 11 |     $ cd foo | 
|---|
| 12 |     $ bkmk init | 
|---|
| 13 |     # writes a basic conf.yml, creates a bookmarks.db SQLite database using bookmarks.sql | 
|---|
| 14 |     # could prompt for settings or take them on the command line | 
|---|
| 15 |     $ bkmk start | 
|---|
| 16 |     # starts up the server using starman, by default on port 5000 | 
|---|
| 17 |     $ bkmk stop | 
|---|
| 18 |     # stops the running server | 
|---|
| 19 |  | 
|---|
| 20 | Deleting 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 |  | 
|---|
| 32 | Paging 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 |     } | 
|---|
       
      
      Note: See 
TracBrowser
        for help on using the repository browser.