Changeset 15 in bookmarks for trunk/BookmarkApp.pm


Ignore:
Timestamp:
02/09/13 21:02:43 (11 years ago)
Author:
peter
Message:
  • Bookmarks uses Moose instead of Class::Accessor
  • if not dbh is specified in the Bookmarks constructor, it can use a dbname parameter to create a SQLite DBH
  • the SQLite DBH created form dbname has the foreign_keys pragma set
  • added foreign key constraints to the bookmarks.sql table definitions for bookmarks and tags
  • added a required --file option to bkmk to specify the database file to use
  • added a load command to bkmk that loads bookmarks dumped as YAML using bkmk list
  • Bookmarks::add() can take mtime and id parameters (useful for reconstructing a database from the YAML dump of bkmk list)
  • BookmarkApp and bkmk no longer use DBI directly; just pass a dbname to the Bookmarks constructor
  • changed the default database for BookmarkApp to fk.db (schema from this revision's updated bookmarks.sql, with foreign keys)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BookmarkApp.pm

    r13 r15  
    66use CGI::Application::Plugin::TT; 
    77 
    8 use DBI; 
    98use Encode; 
    109use JSON; 
     
    1817$base_uri->path($ENV{SCRIPT_NAME} . '/'); 
    1918 
    20 my $dbname = 'new.db'; 
    21 my $dbh = DBI->connect("dbi:SQLite:dbname=$dbname", "", "", { RaiseError => 1 }); 
     19my $dbname = 'fk.db'; 
    2220my $bookmarks = Bookmarks->new({ 
    23     dbh => $dbh, 
     21    dbname   => $dbname, 
    2422    base_uri => $base_uri->canonical, 
    2523}); 
Note: See TracChangeset for help on using the changeset viewer.