Alex,
A few things don't seem to be documented in the help. From the spider plugin:
$self->debug( "Creating Hosts table" ) if ($self->{_debug});
my $c = $DB->creator($prefix.'Hosts');
$c->cols (
ID => { pos => 1, type => 'INT', not_null => 1, unsigned => 1, regex => '^\d+$' },
Hostname => { pos => 2, type => 'CHAR', size => 100, not_null => 1 },
Robot => { pos => 3, type => 'TEXT' },
Last_Hit_Tic => { pos => 4, type => 'INT', unsigned => 1 },
Hits_Interval => { pos => 5, type => 'INT', unsigned => 1 },
Banned => { pos => 6, type => 'ENUM', values => ['Yes', 'No'], not_null => 1, default => 'No' },
Descend_Only => { pos => 7, type => 'ENUM', values => ['Yes', 'No'], not_null => 1, default => 'No' },
Status => { pos => 8, type => 'INT', not_null => 1, unsigned => 1, regex => '^\d+$' },
Max_Depth => { pos => 9, type => 'INT', unsigned => 1 },
);
$c->pk('ID');
$c->ai('ID');
$opts->{hosts_subclass} and $c->subclass( $opts->{hosts_subclass} );
$c->index({
hstndx => [ 'Hostname' ]
});
if ($c->create($action,$opts->{action_opts})) { $err{'Hosts'} = 'OK' }
else {
$err{'Hosts'} = $GT::SQL::error;
$c->save_schema();
}
$c = $DB->creator($prefix.'Hosts');
Is it still necessary to use $prefix? Or does it get used automatically now?
What is the subclass function? Also, when would you want to use this form of the creator, rather than the form that was used in the search logger:
if (! $c2->create()) {
$GT::SQL::errcode ||= ''; #silence -w, ugh.
$GT::SQL::errcode eq 'TBLEXISTS' ? ($message = "Could not create table SearchLogDaily (table already exists)\n") :
($error = "Could not create table SearchLogDaily: $GT::SQL::error)");
$c2->set_defaults();
$c2->save_schema();
};
I'm trying to figure this out, but seem there is a lot of catching up to do :)
PUGDOG� Enterprises, Inc.
The best way to contact me is to NOT use Email.
Please leave a PM here.
A few things don't seem to be documented in the help. From the spider plugin:
Code:
# --------- Hosts Table ---------------- $self->debug( "Creating Hosts table" ) if ($self->{_debug});
my $c = $DB->creator($prefix.'Hosts');
$c->cols (
ID => { pos => 1, type => 'INT', not_null => 1, unsigned => 1, regex => '^\d+$' },
Hostname => { pos => 2, type => 'CHAR', size => 100, not_null => 1 },
Robot => { pos => 3, type => 'TEXT' },
Last_Hit_Tic => { pos => 4, type => 'INT', unsigned => 1 },
Hits_Interval => { pos => 5, type => 'INT', unsigned => 1 },
Banned => { pos => 6, type => 'ENUM', values => ['Yes', 'No'], not_null => 1, default => 'No' },
Descend_Only => { pos => 7, type => 'ENUM', values => ['Yes', 'No'], not_null => 1, default => 'No' },
Status => { pos => 8, type => 'INT', not_null => 1, unsigned => 1, regex => '^\d+$' },
Max_Depth => { pos => 9, type => 'INT', unsigned => 1 },
);
$c->pk('ID');
$c->ai('ID');
$opts->{hosts_subclass} and $c->subclass( $opts->{hosts_subclass} );
$c->index({
hstndx => [ 'Hostname' ]
});
if ($c->create($action,$opts->{action_opts})) { $err{'Hosts'} = 'OK' }
else {
$err{'Hosts'} = $GT::SQL::error;
$c->save_schema();
}
$c = $DB->creator($prefix.'Hosts');
Is it still necessary to use $prefix? Or does it get used automatically now?
What is the subclass function? Also, when would you want to use this form of the creator, rather than the form that was used in the search logger:
Code:
if (! $c2->create()) {
$GT::SQL::errcode ||= ''; #silence -w, ugh.
$GT::SQL::errcode eq 'TBLEXISTS' ? ($message = "Could not create table SearchLogDaily (table already exists)\n") :
($error = "Could not create table SearchLogDaily: $GT::SQL::error)");
$c2->set_defaults();
$c2->save_schema();
};
I'm trying to figure this out, but seem there is a lot of catching up to do :)
PUGDOG� Enterprises, Inc.
The best way to contact me is to NOT use Email.
Please leave a PM here.