eliminazione utilizzo del db mums
This commit is contained in:
@@ -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!!!";
|
||||
|
||||
@@ -16,8 +16,8 @@ my $password = 'laravel';
|
||||
my $db_lar = 'ase_lar';
|
||||
my $db_sp = 'ase_lar';
|
||||
my $server = 'localhost';
|
||||
my $db_name = "ase_mums";
|
||||
my $table = "RAWDATA";
|
||||
my $db_name = "ase_lar";
|
||||
my $table = "RAWDATACOR";
|
||||
my ( @CSVData, @sql );
|
||||
my $outcount = 0;
|
||||
my $outfilenum = 0;
|
||||
@@ -81,14 +81,6 @@ sub writeOutSql {
|
||||
@sql = ();
|
||||
print SQLOUT "/* unlock table */\nUNLOCK TABLES;\n";
|
||||
|
||||
if ( $table eq 'RAWDATA' ) {
|
||||
print SQLOUT "/* call stored procedure to copy in "
|
||||
. $db_sp
|
||||
. "*/\ncall "
|
||||
. $db_sp
|
||||
. ".CopyAndFill('$tn');\n";
|
||||
}
|
||||
|
||||
close SQLOUT
|
||||
or die( getTimeStamp("log")
|
||||
. " - pid $$ >> Error in closing file "
|
||||
|
||||
Reference in New Issue
Block a user