Prepare for git repository
[spider.git] / perl / DXSql / mysql.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::mysql;
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(show tables);
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 auto_increment primary key ,
35 freq real not null,
36 spotcall varchar(14) not null,
37 time int not null,
38 comment varchar(255),
39 spotter varchar(14) not null,
40 spotdxcc smallint,
41 spotterdxcc smallint,
42 origin varchar(14),
43 spotitu tinyint,
44 spotcq tinyint,
45 spotteritu tinyint,
46 spottercq tinyint,
47 spotstate char(2),
48 spotterstate char(2)
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;