diff --git a/LoadCSVData.pl b/LoadCSVData.pl index 64f1e75..4f488b4 100644 --- a/LoadCSVData.pl +++ b/LoadCSVData.pl @@ -16,8 +16,8 @@ my $password = 'laravel'; my $db_lar = 'ase_lar'; my $db_sp = 'ase_lar'; my $server = 'localhost'; -my $db_name = "ase_lar"; -my $table = "RAWDATACOR"; +my $db_name = "ase_mums"; +my $table = "RAWDATA"; my ( @CSVData, @sql ); my $outcount = 0; my $outfilenum = 0; @@ -37,6 +37,8 @@ my $ftp_parm; my $ftp_filename; my $ftp_target; my $unit_id; +my $unit; +my $unittype; my $matlab_rt = "/usr/local/MATLAB/MATLAB_Runtime/v93"; my $matlab_func_dir = "/usr/local/matlab_func/"; @@ -81,6 +83,14 @@ 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 " @@ -105,7 +115,7 @@ sub matlabCalc { $ENV{"HOME"} = "/" . $ENV{"HOME"}; chdir($matlab_func_dir) or die "cannot change: $!\n"; - my @args = ( $matlab_cmd, $matlab_rt, $tool); + my @args = ( $matlab_cmd, $matlab_rt, $unit, $tool); system(@args) == 0 or die( getTimeStamp("log") . " - pid $$ >> system @args failed: $?\n" ); } else { @@ -352,9 +362,12 @@ if ( $db_name ne 'asega' ) { $db_lar = $db_name; $table = "RAWDATACOR"; } +else { + $db_name = 'ase_mums'; +} my ( $fileDate, $fileTime ) = split( /\s/, ); -my ( $unittype, $unit ) = split( /\s/, uc ); +($unittype, $unit ) = split( /\s/, uc ); $unit =~ s/;+$//; while ( my $line = ) {