X-Git-Url: http://www.dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXSql%2Fmysql.pm;fp=perl%2FDXSql%2Fmysql.pm;h=f5a27a0791b30e31e40ef27bfec05e3a2737dc97;hb=0e896695f3297c3989a5159af0a36f28d8164c15;hp=ff708da61f038ba76f6d4b6d16288672a388131e;hpb=4e42369e6f34642784560dc41e54bf5cb029757f;p=spider.git diff --git a/perl/DXSql/mysql.pm b/perl/DXSql/mysql.pm index ff708da6..f5a27a07 100644 --- a/perl/DXSql/mysql.pm +++ b/perl/DXSql/mysql.pm @@ -29,6 +29,29 @@ sub show_tables return @out; } +sub has_ipaddr +{ + my $self = shift; + my $s = q(describe spot); + my $sth = $self->prepare($s); + $sth->execute; + while (my @t = $sth->fetchrow_array) { + if ($t[0] eq 'ipaddr') { + $sth->finish; + return 1; + } + } + $sth->finish; + return undef; +} + +sub add_ipaddr +{ + my $self = shift; + my $s = q(alter table spot add column ipaddr varchar(40)); + $self->do($s); +} + sub spot_create_table { my $self = shift; @@ -47,7 +70,8 @@ spotcq tinyint, spotteritu tinyint, spottercq tinyint, spotstate char(2), -spotterstate char(2) +spotterstate char(2), +ipaddr varchar(40) )}; $self->do($s); } @@ -55,10 +79,10 @@ spotterstate char(2) sub spot_add_indexes { my $self = shift; - $self->do('create index spot_ix1 on spot(time desc)'); dbg('adding spot index ix1'); - $self->do('create index spot_ix2 on spot(spotcall asc)'); + $self->do('create index spot_ix1 on spot(time desc)'); dbg('adding spot index ix2'); + $self->do('create index spot_ix2 on spot(spotcall asc)'); }