From ce07a37ddab2fc8e515522796e172f606cf1c9cc Mon Sep 17 00:00:00 2001 From: mattf Date: Thu, 23 Nov 2006 03:47:53 +0000 Subject: [PATCH] small change to ADMIN_adjust_GMTnow script add index to vicidial_list for postal_code git-svn-id: svn://192.168.202.10@405 3d104415-ff17-0410-8863-d5cf3c621b8a --- bin/ADMIN_adjust_GMTnow_on_leads.pl | 18 +++++++++++++++--- extras/MySQL_AST_CREATE_tables.sql | 3 ++- extras/upgrade_2.0.2.sql | 2 ++ 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/bin/ADMIN_adjust_GMTnow_on_leads.pl b/bin/ADMIN_adjust_GMTnow_on_leads.pl index c48f3a6d..d37bb97d 100644 --- a/bin/ADMIN_adjust_GMTnow_on_leads.pl +++ b/bin/ADMIN_adjust_GMTnow_on_leads.pl @@ -261,6 +261,7 @@ foreach (@phone_codes) ##### BEGIN RUN LOOP FOR EACH COUNTRY CODE/AREA CODE RECORD THAT IS INSIDE THIS COUNTRY CODE ##### $e=0; + $area_updated_count=0; foreach (@codefile) { chomp($codefile[$e]); @@ -401,7 +402,11 @@ foreach (@phone_codes) { $stmtA = "update vicidial_list set gmt_offset_now='$area_GMT' where phone_code='$match_code_ORIG' $AC_match and gmt_offset_now != '$area_GMT';"; if($DB){print STDERR "\n|$stmtA|\n";} - if (!$T) {$affected_rows = $dbhA->do($stmtA); } + if (!$T) + { + $affected_rows = $dbhA->do($stmtA); + $area_updated_count = ($area_updated_count + $affected_rows); + } $Prec_countW = sprintf("%8s", $rec_countW); if ($DB) {print " $Prec_countW records in $match_code_ORIG $area_code updated to $area_GMT\n";} $ee++; @@ -426,6 +431,7 @@ foreach (@phone_codes) { ##### BEGIN RUN LOOP FOR EACH POSTAL CODE RECORD THAT IS INSIDE THIS COUNTRY CODE ##### if ($DB) {print "POSTAL CODE RUN START...\n";} + $postal_updated_count=0; $e=0; foreach (@postalfile) { @@ -550,14 +556,18 @@ foreach (@phone_codes) if (!$rec_countW) { - if ($DB) {print " ALL GMT ALREADY CORRECT FOR : $match_code_ORIG $area_code $area_GMT\n";} + if ($DB) {print " ALL GMT ALREADY CORRECT FOR : $match_code_ORIG $postal_code $area_GMT\n";} $ei++; } else { $stmtA = "update vicidial_list set gmt_offset_now='$area_GMT' where phone_code='$match_code_ORIG' $AC_match and gmt_offset_now != '$area_GMT';"; if($DB){print STDERR "\n|$stmtA|\n";} - if (!$T) {$affected_rows = $dbhA->do($stmtA); } + if (!$T) + { + $affected_rows = $dbhA->do($stmtA); + $postal_updated_count = ($postal_updated_count + $affected_rows); + } $Prec_countW = sprintf("%8s", $rec_countW); if ($DB) {print " $Prec_countW records in $match_code_ORIG $postal_code updated to $area_GMT\n";} $ee++; @@ -584,6 +594,8 @@ foreach (@phone_codes) $dbhA->disconnect(); +if($DB){print "Postal Updates: $postal_updated_count\n";} +if($DB){print "Area Code Updates: $area_updated_count\n";} if($DB){print "\nDONE\n";} exit; diff --git a/extras/MySQL_AST_CREATE_tables.sql b/extras/MySQL_AST_CREATE_tables.sql index 69990b8f..76aa0e68 100644 --- a/extras/MySQL_AST_CREATE_tables.sql +++ b/extras/MySQL_AST_CREATE_tables.sql @@ -267,7 +267,8 @@ index (phone_number), index (list_id), index (called_since_last_reset), index (status), -index (gmt_offset_now) +index (gmt_offset_now), +index (postal_code) ); CREATE TABLE vicidial_hopper ( diff --git a/extras/upgrade_2.0.2.sql b/extras/upgrade_2.0.2.sql index a84293b4..d9d2607b 100644 --- a/extras/upgrade_2.0.2.sql +++ b/extras/upgrade_2.0.2.sql @@ -43,3 +43,5 @@ DST_range VARCHAR(8), country CHAR(3), country_code SMALLINT(5) UNSIGNED ); + +ALTER TABLE vicidial_list ADD index (postal_code);