eliminazione utilizzo del db mums

This commit is contained in:
2018-03-29 21:35:54 +02:00
parent f12a30b1e8
commit 84e3bd28ee
2 changed files with 10 additions and 13 deletions

View File

@@ -8,11 +8,13 @@ use Mail::Sender;
# Variables
my $username = 'aseuser';
my $password = 'Mums0001!';
my $database = 'ase_mums';
#my $database = 'ase_mums';
my $database = 'ase_lar';
my $db_lar = 'ase_lar';
my $server = 'localhost';
my ($email_msg, $email_obj, $tools_info, $ref_date);
my $act_tool = 0;
my $gd_tool = 0;
#my $email_addr = 'alessandro.battilani@gmail.com';
my $email_addr = 'aseparma@gmail.com,alessandro.battilani@gmail.com,corrado@geielettronica.it,luca.chiapponi@unipr.it';
@@ -129,6 +131,9 @@ if ($sth->rows < 0) {
$ToolName{$results->{'ToolNameID'}}{'ErroriTotaliLetture'} = "--";
if ($results->{'ToolState'} eq "Active" ){
$act_tool++;
}
if (substr($results->{'ToolNameID'},0,2) eq "GD" ){
$act_tool++;
}
}
}
@@ -140,7 +145,7 @@ $dbh->disconnect;
$dbh = DBI->connect("DBI:mysql:$database;host=$server", $username, $password)
or die getLoggingTime() . " - Could not connect to database: $DBI::errstr";
my $stw = $dbh->prepare("select ToolNameID, EventDate, count(EventTime) 'LettureNodi', truncate(Count(EventTime)/max(NodeNum),1) 'LettureCatene', max(NodeNum) 'NumeroNodi' from RAWDATA where ToolNameId not like 'DT009%' and EventDate = subdate(curdate(),1) group by ToolNameID")
my $stw = $dbh->prepare("select ToolNameID, EventDate, count(EventTime) 'LettureNodi', truncate(Count(EventTime)/max(NodeNum),1) 'LettureCatene', max(NodeNum) 'NumeroNodi' from RAWDATACOR where EventDate = subdate(curdate(),1) group by ToolNameID")
or die getLoggingTime() . " - $DBI::errstr";
$stw->execute();
@@ -154,7 +159,7 @@ if ($stw->rows == 0) {
$ToolName{$results->{'ToolNameID'}}{'NumeroNodi'} = $results->{'NumeroNodi'};
$ref_date = $results->{'EventDate'};
}
if ($act_tool == $stw->rows) {
if (($act_tool + $gd_tool) == $stw->rows) {
$email_obj = "Tutte le letture pervenute.";
} else {
$email_obj = "ATTENZIONE: alcune letture non pervenute!!!";