changed ADMIN_area_code_populate.pl to DBI

git-svn-id: svn://192.168.202.10@124 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2006-08-07 17:59:47 +00:00
parent bfd88ab4d3
commit 5503f110a8
2 changed files with 10 additions and 10 deletions
@@ -1,28 +1,26 @@
#!/usr/bin/perl
# ADMIN_area_code_populate.pl version 1.1.12 for Perl
# ADMIN_area_code_populate.pl version 0.3 *DBI-version*
#
# 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
# 60807-1003 - Changed to DBI
#
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
use Net::MySQL;
use DBI;
### Make sure this file is in a libs path or put the absolute path to it
require("/home/cron/AST_SERVER_conf.pl"); # local configuration file
if (!$DB_port) {$DB_port='3306';}
$dbh = Net::MySQL->new(hostname => "$DB_server", database => "$DB_database", user => "$DB_user", password => "$DB_pass", port => "$DB_port")
or die "Couldn't connect to database: $DB_server - $DB_database\n";
$dbhA = DBI->connect("DBI:mysql:$DB_database:$DB_server:$DB_port", "$DB_user", "$DB_pass")
or die "Couldn't connect to database: " . DBI->errstr;
$slash_star = '\*';
@@ -50,7 +48,7 @@ $slash_star = '\*';
{
chop($ins_stmt);
chop($ins_stmt);
$dbh->query($ins_stmt) || die "can't execute query: |$ins_stmt| $!\n";
$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";
}
@@ -60,8 +58,10 @@ $slash_star = '\*';
chop($ins_stmt);
chop($ins_stmt);
$dbh->query($ins_stmt);
$affected_rows = $dbhA->do($ins_stmt);
$ins_stmt="insert into vicidial_phone_codes VALUES ";
print STDERR "$pc\n";
$dbhA->disconnect();
exit;
+1 -1
View File
@@ -469,7 +469,7 @@ while($one_day_interval > 0)
&event_logger;
$dbhA->close;
$dbhA->disconnect();
if($DB){print "DONE... Exiting... Goodbye... See you later... Really I mean it this time\n";}