App-FTNDB
view release on metacpan or search on metacpan
bin/ftndb-nodelist view on Meta::CPAN
}
# If zone_number is defined, then go to the next line if the zone
# number is not the same as zone_number
if (defined $zone_number) {
if ($zone != $zone_number) {
next;
}
}
# Execute the insert SQL statment
$insert_handle->execute($type, $zone, $net, $node, $point, $region,
$name, $location, $sysop, $phone, $bps, $flags, $domain, $nl_info{'Year'}, $nl_info{'YearDay'}, $nodelist_file)
or die logging($log_file, $log_id, $DBI::errstr);
}
$insert_handle->finish;
undef $insert_handle;
if ($opt_v) { logging($log_file, $log_id, 'Create ftnnode index'); }
# Recreate ftnnode Index
my $index_name = 'ftnnode';
my $index_fields = 'zone,net,node,point,domain';
FTN::Database::create_ftn_index($db_handle, $table_name, $index_name, $index_fields);
if ($opt_v) { logging($log_file, $log_id, 'Closing database'); }
# disconnect from database
FTN::Database::close_ftn_database($db_handle);
close NODELIST;
logging($log_file, $log_id, 'Nodelist table loaded... ');
return();
}
########################################################################
# List information from FTN nodelist
########################################################################
sub list_ftn_nodelist {
if (!defined $list_file) {
print "The output file option, -o, was not defined.\n";
HELP_MESSAGE();
exit 1;
}
# connect to database
my $db_handle = FTN::Database::open_ftn_database(\%db_option);
# build Select query sql statement
my $sql_statement = "SELECT * FROM $table_name WHERE zone = $zone_number and net = $net_number ";
$sql_statement .= 'ORDER by node ASC';
# execute query
my $query_handle = $db_handle->prepare($sql_statement);
$query_handle->execute();
$query_handle->bind_columns(\my($id, $type, $zone, $net, $node, $point, $region,
$name, $location, $sysop, $phone, $baud, $flags, $domain, $ftnyear, $yearday, $source, $updated));
open(ListFile, ">$list_file") or die "Cannot open $list_file\n";
while($query_handle->fetch()) {
write ListFile;
}
close ListFile;
# finish query
$query_handle->finish;
undef $query_handle;
# disconnect from database
FTN::Database::close_ftn_database($db_handle);
return ();
format ListFile_TOP =
Zone @<<<< Net @<<<<
$zone_number, $net_number
------------------------------------------------------------------------
.
format ListFile =
Node: @<<<<
$node
Name: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$name
Sysop: @<<<<<<<<<<<<<<<<
$sysop
Location: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$location
Phone: @<<<<<<<<<<<<<<<< Baud: @<<<<<
$phone, $baud
Flags: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$flags
.
}
########################################################################
# get nodelist filename, given path & base name
########################################################################
sub get_nodelist_filename {
# Find the most recent version (by day number) when given a base name & dir
# of the nodelist; once this is implemented, this will be the default.
# Note that if there is more than one file with the same base name, it will
# use the first one found.
use constant MinusOne => -1;
my ($basename) = @_;
my ( $i, @files );
if ($opt_v) { logging($log_file, $log_id, "Searching for $basename files.") }
( run in 1.279 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )