1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
use DBI; use DBD::Backup; my $dsn = "DBI:mysql:database=$datenbank;host=$db_host;port=$db_port"; my $dbh = DBI::->connect( $dsn, $db_user, $db_pw, { RaiseError => 1, PrintError => 0, AutoCommit => 1, mysql_enable_utf8 => 1 } ); my $mb = new_from_DBH DBD::Backup($dbh,{'USE_REPLACE' => 1, 'SHOW_TABLE_NAMES' => 1}); open (AUSGABE, ">sicherung.sql"); print AUSGABE "DROP TABLE IF EXISTS `Test`;\n"; print AUSGABE $mb->table_desc('Test'); print AUSGABE $mb->table_data('Test'); print AUSGABE "DROP TABLE IF EXISTS `Test2`;\n"; print AUSGABE $mb->table_desc('Test2'); print AUSGABE $mb->table_data('Test2'); close (AUSGABE);
1 2 3 4 5 6 7 8 9 10 11 12
use Encode qw(decode); open (AUSGABE, ">sicherung.sql"); binmode AUSGABE; my $data; .... $data = $mb->table_desc('Test'); $data = Encode::decode("UTF-8",$data); print AUSGABE $data;
1
2
3
4
5
6
7
8
9
10
Wide character in print at xyz.pl line 5724.
Wide character in print at xyz.pl line 5724.
Tk::Error: Cannot decode string with wide characters at C:/Perl/lib/Encode.pm line 174.
Encode::decode at C:/Perl/lib/Encode.pm line 174
main::__ANON__ at xyz.pl line 5723
Tk callback for .toplevel.button1
Tk::__ANON__ at C:/Perl/site/lib/Tk.pm line 250
Tk::Button::butUp at C:/Perl/site/lib/Tk/Button.pm line 175
<ButtonRelease-1>
(command bound to event)