Update zmupdate.pl.in

mysql generates a warning, instead of an error, when trying to convert to InnoDB and that engine is not available.  By temporarily elevating warnings to errors, we can catch these rather than silently failing.
This commit is contained in:
Andrew Bauer 2014-02-04 15:30:04 -06:00
parent 4f2b09a36d
commit e5ac6e95fa
1 changed files with 2 additions and 0 deletions

View File

@ -338,10 +338,12 @@ if ( @MyISAM_Tables ) {
if ( $response =~ /^[yY]$/ ) { if ( $response =~ /^[yY]$/ ) {
print "\nConverting MyISAM tables to InnoDB. Please wait.\n"; print "\nConverting MyISAM tables to InnoDB. Please wait.\n";
foreach (@MyISAM_Tables) { foreach (@MyISAM_Tables) {
$dbh->do(q|SET sql_mode='traditional'|); # Elevate warnings to errors
my $sql = "ALTER TABLE $_ ENGINE = InnoDB"; my $sql = "ALTER TABLE $_ ENGINE = InnoDB";
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() ); my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
my $res = $sth->execute() or die( "Can't execute: ".$sth->errstr() ); my $res = $sth->execute() or die( "Can't execute: ".$sth->errstr() );
$sth->finish(); $sth->finish();
$dbh->do(q|SET sql_mode=''|); # Set mode back to default
} }
} }
} }