Prepare for git repository
[spider.git] / perl / DXSql / SQLite.pm
1 #
2 # Module for SQLite DXSql variants
3 #
4 # Stuff like table creates and (later) alters
5 #
6 # $Id$
7 #
8 # Copyright (c) 2005 Dirk Koopman G1TLH
9 #
10
11 package DXSql::SQLite;
12
13 use DXDebug;
14
15 use vars qw(@ISA);
16 @ISA = qw{DXSql};
17
18 sub show_tables
19 {
20         my $self = shift;
21         my $s = q(SELECT name FROM sqlite_master WHERE type='table' ORDER BY name);
22         my $sth = $self->prepare($s);
23         $sth->execute;
24         my @out;
25         push @out, $sth->fetchrow_array;
26         $sth->finish;
27         return @out;
28 }
29
30 sub spot_create_table
31 {
32         my $self = shift;
33         my $s = q{create table spot (
34 rowid integer primary key,
35 freq real not null,
36 spotcall text not null,
37 time int not null,
38 comment text,
39 spotter text not null,
40 spotdxcc int,
41 spotterdxcc int,
42 origin text,
43 spotitu int,
44 spotcq int,
45 spotteritu int,
46 spottercq int,
47 spotstate text,
48 spotterstate text
49 )};
50         $self->do($s);
51 }
52
53 sub spot_add_indexes
54 {
55         my $self = shift;
56         $self->do('create index spot_ix1 on spot(time desc)');
57         dbg('adding spot index ix1');
58         $self->do('create index spot_ix2 on spot(spotcall asc)');
59         dbg('adding spot index ix2');
60 }
61
62
63 1;