From 72353f4d32f564669a6e617e37937a78fe56fa96 Mon Sep 17 00:00:00 2001 From: Jean-Marie Renouard Date: Fri, 3 Mar 2023 15:43:11 +0100 Subject: [PATCH] new version of select_csv_file --- mysqltuner.pl | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/mysqltuner.pl b/mysqltuner.pl index 8a6f0c7..36da443 100755 --- a/mysqltuner.pl +++ b/mysqltuner.pl @@ -1050,16 +1050,12 @@ sub select_csv_file { my $tfile= shift; my $req = shift; debugprint "PERFORM: $req CSV into $tfile"; - `$mysqlcmd $mysqllogin -Bse "\\w$req" 2>>/dev/null| sed "s/'/\'/;s/\t/\",\"/g;s/^/\"/;s/$/\"/;s/\n//g" > $tfile`; - if ( $? != 0 ) { - badprint "Failed to execute: $req"; - badprint "FAIL Execute SQL / return code: $?"; - debugprint "CMD : $mysqlcmd"; - debugprint "OPTIONS: $mysqllogin"; - debugprint `$mysqlcmd $mysqllogin -Bse "$req" 2>&1`; - - #exit $?; + my @result =select_array($req); + open( my $fh, '>', $tfile ) or die "Could not open file '$tfile' $!"; + for my $l (@result) { + print $fh $l; } + close $fh; } sub human_size { my ( $size, $n ) = ( shift, 0 );