adding generic function dump_into_file
This commit is contained in:
parent
e0e2168f06
commit
183aac3f4a
1 changed files with 12 additions and 7 deletions
|
@ -2750,6 +2750,17 @@ sub check_storage_engines {
|
||||||
|
|
||||||
my %mycalc;
|
my %mycalc;
|
||||||
|
|
||||||
|
sub dump_into_file {
|
||||||
|
my $file=shift;
|
||||||
|
my $content=shift;
|
||||||
|
if ( -d "$opt{dumpdir}" ) {
|
||||||
|
$file="$opt{dumpdir}/$file";
|
||||||
|
open (FILE, ">$file") or die "Can't open $file: $!";
|
||||||
|
print FILE $content;
|
||||||
|
close FILE;
|
||||||
|
infoprint "Data saved to $file";
|
||||||
|
}
|
||||||
|
}
|
||||||
sub calculations {
|
sub calculations {
|
||||||
if ( $mystat{'Questions'} < 1 ) {
|
if ( $mystat{'Questions'} < 1 ) {
|
||||||
badprint "Your server has not answered any queries: cannot continue...";
|
badprint "Your server has not answered any queries: cannot continue...";
|
||||||
|
@ -3790,13 +3801,7 @@ sub mysql_myisam {
|
||||||
$sql_mig="${sql_mig}-- InnoDB migration for $myisam_table\nALTER TABLE $myisam_table ENGINE=InnoDB;\n\n";
|
$sql_mig="${sql_mig}-- InnoDB migration for $myisam_table\nALTER TABLE $myisam_table ENGINE=InnoDB;\n\n";
|
||||||
infoprint "* InnoDB migration request for $myisam_table Table: ALTER TABLE $myisam_table ENGINE=InnoDB;";
|
infoprint "* InnoDB migration request for $myisam_table Table: ALTER TABLE $myisam_table ENGINE=InnoDB;";
|
||||||
}
|
}
|
||||||
if ( -d "$opt{dumpdir}" ) {
|
dump_into_file("migrate_myisam_to_innodb.sql", $sql_mig );
|
||||||
my $file_mig="$opt{dumpdir}/migrate_myisam_to_innodb.sql";
|
|
||||||
open (FILE, ">$file_mig") or die "Can't open $file_mig: $!";
|
|
||||||
print FILE $sql_mig;
|
|
||||||
close FILE;
|
|
||||||
infoprint "Migration script saved to $file_mig";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
infoprint("General MyIsam metrics:");
|
infoprint("General MyIsam metrics:");
|
||||||
infoprint " +-- Total MyISAM Tables : $nb_myisam_tables";
|
infoprint " +-- Total MyISAM Tables : $nb_myisam_tables";
|
||||||
|
|
Loading…
Reference in a new issue