2006-06-16 snapshot
git-svn-id: svn://192.168.202.10@9 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -1,11 +1,15 @@
|
||||
#!/usr/bin/perl
|
||||
# ADMIN_area_code_populate.pl version 1.1 for Perl
|
||||
# ADMIN_area_code_populate.pl version 1.1.12 for Perl
|
||||
#
|
||||
# Copyright (C) 2006 Joe Johnson,Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
|
||||
#
|
||||
# Description:
|
||||
# server application that allows load areacodes into to asterisk list database
|
||||
#
|
||||
#
|
||||
# CHANGES
|
||||
# 60615-1514 - Changed to ignore the header row
|
||||
#
|
||||
|
||||
use lib ".\\",".\\libs", './', './libs', '../libs', '/usr/local/perl_TK/libs', 'C:\\AST_VICI\\libs';
|
||||
use Time::HiRes ('gettimeofday','usleep','sleep'); # needed to have perl sleep in increments of less than one second
|
||||
@@ -27,25 +31,31 @@ $slash_star = '\*';
|
||||
close(codefile);
|
||||
$pc=0;
|
||||
$ins_stmt="insert into vicidial_phone_codes VALUES ";
|
||||
foreach (@codefile) {
|
||||
foreach (@codefile)
|
||||
{
|
||||
@row=split(/\t/, $codefile[$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;
|
||||
$pc++;
|
||||
$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);
|
||||
$dbh->query($ins_stmt) || die "can't execute query: |$ins_stmt| $!\n";
|
||||
$ins_stmt="insert into vicidial_phone_codes VALUES ";
|
||||
print STDERR "$pc\n";
|
||||
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);
|
||||
$dbh->query($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);
|
||||
|
||||
Reference in New Issue
Block a user