summaryrefslogtreecommitdiff
path: root/script/bookmarks_makedb.pl
blob: 93027a7a28949f027818970ae124390285d6117e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/perl 
use strict;
use warnings;
use DBI;
use FindBin;
use Path::Class;
 
my $DBHOME=dir($FindBin::Bin)->parent->file('bookmarks.db');
 
my $db=DBI->connect("dbi:SQLite:$DBHOME");
 
local $/='';
while (<DATA>) {
    my $rv=$db->do($_);
    warn 'Problemi: '.$db->errstr() unless $rv;
}
 
__DATA__
drop table links_tags;
 
drop table links;
 
drop table tags;
 
create table links (
 pk integer primary key autoincrement,
 url text unique,
 title text,
 descr text,
 icon blob,
 add_date integer,
 last_access_date integer,
 access_count integer
);
 
create table tags (
 pk integer primary key autoincrement,
 name text unique,
 descr text
);
 
create table links_tags (
 link integer,
 tag integer
);