breath on database storage engines
[spider.git] / perl / DXSql / mysql.pm
index ff708da61f038ba76f6d4b6d16288672a388131e..dee586f76168c07504287a9365cddbff110db213 100644 (file)
@@ -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);
 }