�&ǐk�@'bJ�h�ۊL'}T� :��'2�Z#$��n�a��� �>a��`��_3d�Qpt�/�P -��#5�,�M��� �pA:©�q�����NW��ډ�A���� �9nʺج���� �TSM��{J6?7��r�@�\����D��� �׶���s�f�TJj?"��D��`?��̒� b�#�%�C*v�$�{�$����5Ծ�F�s��y�e/8��h-�f�̰&(����Gj�L:U� 2�� ����v�_k����Y��gp,�k�WF�R������_C�R��N@���R�@�ߔ?A�w9���F("iNa-S���Q�o�3tDMLh*�#4k�T/iQ��Y*�G��m����)��8�hBm/�I�,g�ﯖ���Z��}�Cz�q@´��d.����L�ŕ�,��1�Z�܌�: ̪���F+J-'��c�tvJ8��]Q-��b��y �6;*J`r_�d ��'�G ~p��)'�C,�%F��E(��2�k�����lР�z�!�=t ��_�0��f7��� ;�p�|�U �% \$opt_engine, "f|force" => \$opt_force, "help|?" => \$opt_help, "h|host=s" => \$opt_host, "p|password=s" => \$opt_password, "u|user=s" => \$opt_user, "v|verbose" => \$opt_verbose, "V|version" => \$opt_version, "S|socket=s" => \$opt_socket, "P|port=i" => \$opt_port ) || usage(0); usage($opt_version) if ($#ARGV < 0 || $opt_help || $opt_version); $opt_database=shift(@ARGV); if (grep { /^$opt_engine$/i } qw(HEAP MEMORY BLACKHOLE)) { print "Converting to '$opt_engine' would delete your data; aborting\n"; exit(1); } $connect_opt=""; if ($opt_port) { $connect_opt.= ";port=$opt_port"; } if (length($opt_socket)) { $connect_opt.=";mariadb_socket=$opt_socket"; } $dbh = DBI->connect("DBI:MariaDB:$opt_database:${opt_host}$connect_opt", $opt_user, $opt_password, { PrintError => 0}) || die "Can't connect to database $opt_database: $DBI::errstr\n"; my @tables; push(@ARGV, "%") if(!@ARGV); foreach $pattern (@ARGV) { my ($sth,$row); $sth=$dbh->prepare("SHOW TABLES LIKE ?"); $rv= $sth->execute($pattern); if(!int($rv)) { warn "Can't get tables matching '$pattern' from $opt_database; $DBI::errstr\n"; exit(1) unless $opt_force; } while (($row = $sth->fetchrow_arrayref)) { push(@tables, $row->[0]); } $sth->finish; } print "Converting tables:\n" if ($opt_verbose); foreach $table (@tables) { my ($sth,$row); # Check if table is already converted $sth=$dbh->prepare("show table status like '$table'"); if ($sth->execute && ($row = $sth->fetchrow_arrayref)) { if (uc($row->[1]) eq uc($opt_engine)) { print "$table already uses the '$opt_engine' engine; Ignored\n"; next; } } print "converting $table\n" if ($opt_verbose); $table=~ s/`/``/g; if (!$dbh->do("ALTER TABLE `$table` ENGINE=$opt_engine")) { print STDERR "Can't convert $table: Error $DBI::errstr\n"; exit(1) if (!$opt_force); $exit_status=1; } } $dbh->disconnect; exit($exit_status); sub usage { my($version)=shift; print "$0 version 1.1\n"; exit(0) if ($version); print <