X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXSql%2FSQLite.pm;fp=perl%2FDXSql%2FSQLite.pm;h=8cb1606d1584f6668c5e43896ac0217bb05f468f;hb=61885d0dba3c8e06146aabb40031609ef1eb5b2e;hp=d151f82e31ac314adae64d4982e13aa93e1b7084;hpb=e1de45af27eb69a8b063a8a88401174cd95e9683;p=spider.git diff --git a/perl/DXSql/SQLite.pm b/perl/DXSql/SQLite.pm index d151f82e..8cb1606d 100644 --- a/perl/DXSql/SQLite.pm +++ b/perl/DXSql/SQLite.pm @@ -22,11 +22,36 @@ sub show_tables my $sth = $self->prepare($s); $sth->execute; my @out; - push @out, $sth->fetchrow_array; + while (my @t = $sth->fetchrow_array) { + push @out, @t; + } $sth->finish; return @out; } +sub has_ipaddr +{ + my $self = shift; + my $s = q(PRAGMA table_info(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; @@ -45,7 +70,8 @@ spotcq int, spotteritu int, spottercq int, spotstate text, -spotterstate text +spotterstate text, +ipaddr text )}; $self->do($s); }