|
|
|
@@ -10,6 +10,7 @@
|
|
|
|
|
# 60615-1514 - Changed to ignore the header row
|
|
|
|
|
# 60807-1003 - Changed to DBI
|
|
|
|
|
# - changed to use /etc/astguiclient.conf for configs
|
|
|
|
|
# 61122-1902 - Added GMT_USA_zip.txt data import for USA postal GMT data
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -65,43 +66,79 @@ $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VA
|
|
|
|
|
|
|
|
|
|
$slash_star = '\*';
|
|
|
|
|
|
|
|
|
|
open(codefile, "$PATHhome/phone_codes_GMT.txt") || die "can't open $PATHhome/phone_codes_GMT.txt: $!\n";
|
|
|
|
|
@codefile = <codefile>;
|
|
|
|
|
close(codefile);
|
|
|
|
|
$pc=0;
|
|
|
|
|
$ins_stmt="insert into vicidial_phone_codes VALUES ";
|
|
|
|
|
foreach (@codefile)
|
|
|
|
|
{
|
|
|
|
|
@row=split(/\t/, $codefile[$pc]);
|
|
|
|
|
if ($codefile[$pc] !~ /GEOGRAPHIC DESCRIPTION/)
|
|
|
|
|
{
|
|
|
|
|
$pc++;
|
|
|
|
|
$row[7] =~ s/\r|\n|\t| $//gi;
|
|
|
|
|
$row[6] =~ s/\r|\n|\t| $//gi;
|
|
|
|
|
$row[5] =~ s/\r|\n|\t| $//gi;
|
|
|
|
|
$row[4] =~ s/\r|\n|\t| $//gi;
|
|
|
|
|
$row[3] =~ s/\r|\n|\t| $//gi;
|
|
|
|
|
$row[2] =~ s/\r|\n|\t| $//gi;
|
|
|
|
|
$row[1] =~ s/\r|\n|\t| $//gi;
|
|
|
|
|
$row[0] =~ s/\r|\n|\t| $//gi;
|
|
|
|
|
$ins_stmt.="('$row[0]', '$row[1]', '$row[2]', '$row[3]', '$row[4]', '$row[5]', '$row[6]', '$row[7]'), ";
|
|
|
|
|
if ($pc =~ /00$/)
|
|
|
|
|
{
|
|
|
|
|
chop($ins_stmt);
|
|
|
|
|
chop($ins_stmt);
|
|
|
|
|
$affected_rows = $dbhA->do($ins_stmt) || die "can't execute query: |$ins_stmt| $!\n";
|
|
|
|
|
$ins_stmt="insert into vicidial_phone_codes VALUES ";
|
|
|
|
|
print STDERR "$pc\n";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {$pc++;}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
chop($ins_stmt);
|
|
|
|
|
chop($ins_stmt);
|
|
|
|
|
$affected_rows = $dbhA->do($ins_stmt);
|
|
|
|
|
$ins_stmt="insert into vicidial_phone_codes VALUES ";
|
|
|
|
|
print STDERR "$pc\n";
|
|
|
|
|
#### BEGIN vicidial_phone_codes population from phone_codes_GMT.txt file ####
|
|
|
|
|
open(codefile, "$PATHhome/phone_codes_GMT.txt") || die "can't open $PATHhome/phone_codes_GMT.txt: $!\n";
|
|
|
|
|
@codefile = <codefile>;
|
|
|
|
|
close(codefile);
|
|
|
|
|
$pc=0;
|
|
|
|
|
$ins_stmt="insert into vicidial_phone_codes VALUES ";
|
|
|
|
|
foreach (@codefile)
|
|
|
|
|
{
|
|
|
|
|
@row=split(/\t/, $codefile[$pc]);
|
|
|
|
|
if ($codefile[$pc] !~ /GEOGRAPHIC DESCRIPTION/)
|
|
|
|
|
{
|
|
|
|
|
$pc++;
|
|
|
|
|
$row[7] =~ s/\r|\n|\t| $//gi;
|
|
|
|
|
$row[6] =~ s/\r|\n|\t| $//gi;
|
|
|
|
|
$row[5] =~ s/\r|\n|\t| $//gi;
|
|
|
|
|
$row[4] =~ s/\r|\n|\t| $//gi;
|
|
|
|
|
$row[3] =~ s/\r|\n|\t| $//gi;
|
|
|
|
|
$row[2] =~ s/\r|\n|\t| $//gi;
|
|
|
|
|
$row[1] =~ s/\r|\n|\t| $//gi;
|
|
|
|
|
$row[0] =~ s/\r|\n|\t| $//gi;
|
|
|
|
|
$ins_stmt.="('$row[0]', '$row[1]', '$row[2]', '$row[3]', '$row[4]', '$row[5]', '$row[6]', '$row[7]'), ";
|
|
|
|
|
if ($pc =~ /00$/)
|
|
|
|
|
{
|
|
|
|
|
chop($ins_stmt);
|
|
|
|
|
chop($ins_stmt);
|
|
|
|
|
$affected_rows = $dbhA->do($ins_stmt) || die "can't execute query: |$ins_stmt| $!\n";
|
|
|
|
|
$ins_stmt="insert into vicidial_phone_codes VALUES ";
|
|
|
|
|
print STDERR "$pc\n";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {$pc++;}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
chop($ins_stmt);
|
|
|
|
|
chop($ins_stmt);
|
|
|
|
|
$affected_rows = $dbhA->do($ins_stmt);
|
|
|
|
|
$ins_stmt="insert into vicidial_phone_codes VALUES ";
|
|
|
|
|
print STDERR "$pc\n";
|
|
|
|
|
#### END vicidial_phone_codes population from phone_codes_GMT.txt file ####
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#### BEGIN vicidial_postal_codes population from GMT_USA_zip.txt file ####
|
|
|
|
|
open(zipfile, "$PATHhome/GMT_USA_zip.txt") || die "can't open $PATHhome/GMT_USA_zip.txt: $!\n";
|
|
|
|
|
@zipfile = <zipfile>;
|
|
|
|
|
close(zipfile);
|
|
|
|
|
$pc=0;
|
|
|
|
|
$ins_stmt="insert into vicidial_postal_codes VALUES ";
|
|
|
|
|
foreach (@zipfile)
|
|
|
|
|
{
|
|
|
|
|
@row=split(/\t/, $zipfile[$pc]);
|
|
|
|
|
$pc++;
|
|
|
|
|
$row[0] =~ s/\r|\n|\t| $//gi;
|
|
|
|
|
$row[1] =~ s/\r|\n|\t| $//gi;
|
|
|
|
|
$row[2] =~ s/\r|\n|\t| $//gi;
|
|
|
|
|
$row[3] =~ s/\r|\n|\t| $//gi;
|
|
|
|
|
$ins_stmt.="('$row[0]', '$row[1]', '$row[2]', '$row[3]', 'USA'), ";
|
|
|
|
|
if ($pc =~ /00$/)
|
|
|
|
|
{
|
|
|
|
|
chop($ins_stmt);
|
|
|
|
|
chop($ins_stmt);
|
|
|
|
|
$affected_rows = $dbhA->do($ins_stmt) || die "can't execute query: |$ins_stmt| $!\n";
|
|
|
|
|
$ins_stmt="insert into vicidial_postal_codes VALUES ";
|
|
|
|
|
print STDERR "$pc\n";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
chop($ins_stmt);
|
|
|
|
|
chop($ins_stmt);
|
|
|
|
|
$affected_rows = $dbhA->do($ins_stmt);
|
|
|
|
|
$ins_stmt="insert into vicidial_postal_codes VALUES ";
|
|
|
|
|
print STDERR "$pc\n";
|
|
|
|
|
#### END vicidial_postal_codes population from GMT_USA_zip.txt file ####
|
|
|
|
|
|
|
|
|
|
$dbhA->disconnect();
|
|
|
|
|
|
|
|
|
|