line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FTN::Database::Nodelist; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
6223
|
use warnings; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
84
|
|
4
|
3
|
|
|
3
|
|
9
|
use strict; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
48
|
|
5
|
3
|
|
|
3
|
|
9
|
use Carp qw( croak ); |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
495
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
FTN::Database::Nodelist - Fidonet/FTN Nodelist SQL Database operations. |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 VERSION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Version 0.40 |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=cut |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our $VERSION = '0.40'; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 DESCRIPTION |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
FTN::Database::Nodelist is a Perl module containing common nodelist related functions |
22
|
|
|
|
|
|
|
for Fidonet/FTN Nodelist related processing on a Nodelist table in an SQL Database, |
23
|
|
|
|
|
|
|
including one that defines the fields for such a Nodelist table. The SQL database |
24
|
|
|
|
|
|
|
engine is one for which a DBD module exists, defaulting to SQLite. |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 EXPORT |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
The following functions are available in this module: define_nodelist_table(), |
29
|
|
|
|
|
|
|
drop_nodelist_table(), ftnnode_index_fields(), remove_ftn_domain(). |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 FUNCTIONS |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head2 define_nodelist_table |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Syntax: $fields = define_nodelist_table(); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
This function returns a string that contains the SQL which defines a |
38
|
|
|
|
|
|
|
Nodelist table for use in an SQL database being used for Fidonet/FTN |
39
|
|
|
|
|
|
|
processing, |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Except for the I field, which is defined in the create_ftn_table |
42
|
|
|
|
|
|
|
subroutine itself, the defined fields are as follows: |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=cut |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub define_nodelist_table { |
47
|
|
|
|
|
|
|
|
48
|
1
|
|
|
1
|
1
|
1818
|
my $table_fields = ''; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=over 4 |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=item type |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
The I field may by empty or may contain one of the following keywords: |
55
|
|
|
|
|
|
|
Zone, Region, Host, Hub, Pvt, Hold, or Down. Defaults to an empty string, which |
56
|
|
|
|
|
|
|
indicates a normal nodelist entry. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=cut |
59
|
|
|
|
|
|
|
|
60
|
1
|
|
|
|
|
1
|
$table_fields = "type VARCHAR(6) DEFAULT '' NOT NULL, "; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=item zone |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
The I field is a number in the range of 0 to 32767 that is the zone number |
65
|
|
|
|
|
|
|
for a particular nodelist table entry. Defaults to the number one. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=cut |
68
|
|
|
|
|
|
|
|
69
|
1
|
|
|
|
|
2
|
$table_fields .= "zone SMALLINT DEFAULT '1' NOT NULL, "; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=item net |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
The I field is used to contain a number in the range of 0 to 32767 that is |
74
|
|
|
|
|
|
|
the net number for a particular nodelist table entry. Defaults to the number one. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=cut |
77
|
|
|
|
|
|
|
|
78
|
1
|
|
|
|
|
1
|
$table_fields .= "net SMALLINT DEFAULT '1' NOT NULL, "; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=item node |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
The I field is used to contain a number in the range of 0 to 32767 that is |
83
|
|
|
|
|
|
|
the node number for a particular nodelist table entry. Defaults to the number one. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=cut |
86
|
|
|
|
|
|
|
|
87
|
1
|
|
|
|
|
1
|
$table_fields .= "node SMALLINT DEFAULT '1' NOT NULL, "; |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=item point |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
The I field is used to contain a number in the range of 0 to 32767 that is |
92
|
|
|
|
|
|
|
the point number for a particular nodelist table entry. Defaults to the number zero. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=cut |
95
|
|
|
|
|
|
|
|
96
|
1
|
|
|
|
|
2
|
$table_fields .= "point SMALLINT DEFAULT '0' NOT NULL, "; |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=item region |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
The I field is used to contain a number in the range of 0 to 32767 that is |
101
|
|
|
|
|
|
|
the region number for a particular nodelist table entry. Defaults to the number zero. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=cut |
104
|
|
|
|
|
|
|
|
105
|
1
|
|
|
|
|
1
|
$table_fields .= "region SMALLINT DEFAULT '0' NOT NULL, "; |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=item name |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
The I field is used to contain the system name as a string. |
110
|
|
|
|
|
|
|
It can contain up to 48 characters and defaults to an empty string. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=cut |
113
|
|
|
|
|
|
|
|
114
|
1
|
|
|
|
|
1
|
$table_fields .= "name VARCHAR(48) DEFAULT '' NOT NULL, "; |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=item location |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
The I field is used to contain the location of the system as a string. |
119
|
|
|
|
|
|
|
It can contain up to 48 characters and defaults to an empty string. |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=cut |
122
|
|
|
|
|
|
|
|
123
|
1
|
|
|
|
|
1
|
$table_fields .= "location VARCHAR(48) DEFAULT '' NOT NULL, "; |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=item sysop |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
The I field is used to contain a string indicating the system operator. |
128
|
|
|
|
|
|
|
It can contain up to 48 characters and defaults to an empty string. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=cut |
131
|
|
|
|
|
|
|
|
132
|
1
|
|
|
|
|
1
|
$table_fields .= "sysop VARCHAR(48) DEFAULT '' NOT NULL, "; |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=item phone |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
The I field is used to contain a string indicating the phone number for |
137
|
|
|
|
|
|
|
the system. It can contain up to 32 characters and defaults to the string |
138
|
|
|
|
|
|
|
I<'000-000-000-000>. |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=cut |
141
|
|
|
|
|
|
|
|
142
|
1
|
|
|
|
|
1
|
$table_fields .= "phone VARCHAR(32) DEFAULT '000-000-000-000' NOT NULL, "; |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=item baud |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
The I field is used to contain the baud rate for the system that a particular |
147
|
|
|
|
|
|
|
nodelist table entry is for. It can contain up to 6 characters and defaults to I<300>. |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=cut |
150
|
|
|
|
|
|
|
|
151
|
1
|
|
|
|
|
1
|
$table_fields .= "baud CHAR(6) DEFAULT '300' NOT NULL, "; |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=item flags |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
The I field is used to contain the nodelist flags for the system that a particular |
156
|
|
|
|
|
|
|
nodelist table entry is for. It can contain up to 128 characters and defaults to a string |
157
|
|
|
|
|
|
|
containing a single space. |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=cut |
160
|
|
|
|
|
|
|
|
161
|
1
|
|
|
|
|
1
|
$table_fields .= "flags VARCHAR(128) DEFAULT ' ' NOT NULL, "; |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=item domain |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
The I field is used to contain the domain name for the system that a particular |
166
|
|
|
|
|
|
|
nodelist table entry is for. It can contain up to 8 characters and defaults to the |
167
|
|
|
|
|
|
|
string I. |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=cut |
170
|
|
|
|
|
|
|
|
171
|
1
|
|
|
|
|
1
|
$table_fields .= "domain VARCHAR(8) DEFAULT 'fidonet' NOT NULL, "; |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=item ftnyear |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
The I field is used to contain the 4 digit integer representing the |
176
|
|
|
|
|
|
|
year that a particular nodelist table entry is valid. Defaults to the number |
177
|
|
|
|
|
|
|
zero. |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=cut |
180
|
|
|
|
|
|
|
|
181
|
1
|
|
|
|
|
1
|
$table_fields .= "ftnyear SMALLINT DEFAULT '0' NOT NULL, "; |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=item yearday |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
The I field is used to contain the three digit day of the year that |
186
|
|
|
|
|
|
|
a particular nodelist table entry is valid for. Defaults to the number zero. |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=cut |
189
|
|
|
|
|
|
|
|
190
|
1
|
|
|
|
|
1
|
$table_fields .= "yearday SMALLINT DEFAULT '0' NOT NULL, "; |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=item source |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
The I |
195
|
|
|
|
|
|
|
nodelist table entry is from. For instance, it could be used to give the name of |
196
|
|
|
|
|
|
|
the nodelist file that the data is from. It can contain up to 16 characters and |
197
|
|
|
|
|
|
|
defaults to the string I. |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=cut |
200
|
|
|
|
|
|
|
|
201
|
1
|
|
|
|
|
1
|
$table_fields .= "source VARCHAR(16) DEFAULT 'local' NOT NULL, "; |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=item updated |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
The I field is used to contain a timestamp for when a particular |
206
|
|
|
|
|
|
|
nodelist table entry was last updated. Defaults to now. |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=back |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=cut |
211
|
|
|
|
|
|
|
|
212
|
1
|
|
|
|
|
1
|
$table_fields .= "updated TIMESTAMP DEFAULT 'now' NOT NULL "; |
213
|
|
|
|
|
|
|
|
214
|
1
|
|
|
|
|
2
|
return($table_fields); |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
} |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
=head2 ftnnode_index_fields |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
Syntax: $fields = ftnnode_index_fields(); |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
This is a function that returns a string containing a comma separated list of |
223
|
|
|
|
|
|
|
the fields that are intended for use in creating the ftnnode database index. |
224
|
|
|
|
|
|
|
The index contains the following fields: zone, net, node, point, domain, |
225
|
|
|
|
|
|
|
ftnyear, and yearday. |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
=cut |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
sub ftnnode_index_fields { |
230
|
|
|
|
|
|
|
|
231
|
1
|
|
|
1
|
1
|
2
|
my $field_list = 'zone,net,node,point,domain,ftnyear,yearday'; |
232
|
|
|
|
|
|
|
|
233
|
1
|
|
|
|
|
1
|
return($field_list); |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
} |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
=head1 EXAMPLES |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
An example of opening an FTN database, then creating a nodelist table, |
240
|
|
|
|
|
|
|
loading data to it, then creating an index on it, and the closing |
241
|
|
|
|
|
|
|
the database: |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
use FTN::Database; |
244
|
|
|
|
|
|
|
use FTN::Database::Nodelist; |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
my $db_handle = open_ftn_database(\%db_option); |
247
|
|
|
|
|
|
|
$fields = define_nodelist_table(); |
248
|
|
|
|
|
|
|
create_ftn_table($db_handle, $table_name, $fields); |
249
|
|
|
|
|
|
|
... (Load data to nodelist table) |
250
|
|
|
|
|
|
|
ftnnode_index_tables($db_handle, $table_name); |
251
|
|
|
|
|
|
|
close_ftn_database($db_handle); |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
=head1 AUTHOR |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
Robert James Clay, C<< >> |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
=head1 BUGS |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
Please report any bugs or feature requests via the web interface at |
260
|
|
|
|
|
|
|
L. I will be |
261
|
|
|
|
|
|
|
notified, and then you'll automatically be notified of progress on |
262
|
|
|
|
|
|
|
your bug as I make changes. |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
Note that you can also report any bugs or feature requests to |
265
|
|
|
|
|
|
|
C, or through the web interface at |
266
|
|
|
|
|
|
|
L; |
267
|
|
|
|
|
|
|
however, the FTN-Database Issue tracker at the SourceForge project |
268
|
|
|
|
|
|
|
is preferred. |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
=head1 SUPPORT |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
perldoc FTN::Database::Nodelist |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
You can also look for information at: |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
=over 4 |
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
=item * FTN::Database issue tracker |
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
L |
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
L |
289
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
=item * Search CPAN |
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
L |
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
=back |
295
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
=head1 SEE ALSO |
297
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
L, L, |
299
|
|
|
|
|
|
|
L |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
Copyright 2010-2013 Robert James Clay, all rights reserved. |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
306
|
|
|
|
|
|
|
under the same terms as Perl itself. |
307
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
=cut |
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
1; # End of FTN::Database::Nodelist |