From 4c221321b624e55238c641b515e24ad1091cdc93 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 12 Mar 2002 11:38:22 +0200 Subject: Added help for --local-infile Fix for bug on intel where (int32) 1 << 32 == 1, which gave problems when using 32 keys. Allow SET PASSWORD for anonymous user Docs/manual.texi: Changelog client/mysql.cc: Added help for --local-infile client/mysqlimport.c: Merge with 4.0. Patch for LOCAL INFILE handling configure.in: cleanup include/global.h: Fix for bug on intel where (int32) 1 << 32 == 1 mysql-test/r/create.result: Test of CREATE TABLE with 32 keys mysql-test/t/create.test: Test of CREATE TABLE with 32 keys scripts/mysqlhotcopy.sh: Patch for databasenames with space. sql/ha_isam.cc: Fix for bug on intel where (int32) 1 << 32 == 1 sql/ha_myisam.cc: Fix for bug on intel where (int32) 1 << 32 == 1 sql/ha_myisammrg.cc: Fix for bug on intel where (int32) 1 << 32 == 1 sql/mysqld.cc: Added help for --local-infile sql/sql_acl.cc: Allow SET PASSWORD of anonymous user sql/table.cc: Fix for bug on intel where (int32) 1 << 32 == 1 --- scripts/mysqlhotcopy.sh | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) (limited to 'scripts') diff --git a/scripts/mysqlhotcopy.sh b/scripts/mysqlhotcopy.sh index b0fee84c332..45f1f1ed24a 100644 --- a/scripts/mysqlhotcopy.sh +++ b/scripts/mysqlhotcopy.sh @@ -37,7 +37,7 @@ WARNING: THIS PROGRAM IS STILL IN BETA. Comments/patches welcome. # Documentation continued at end of file -my $VERSION = "1.15"; +my $VERSION = "1.16"; my $opt_tmpdir = $ENV{TMPDIR} || "/tmp"; @@ -236,9 +236,7 @@ my $num_files = 0; foreach my $rdb ( @db_desc ) { my $db = $rdb->{src}; - eval { $dbh->do( "use $db" ); }; - die "Database '$db' not accessible: $@" if ( $@ ); - my @dbh_tables = $dbh->tables(); + my @dbh_tables = get_list_of_tables( $db ); ## generate regex for tables/files my $t_regex; @@ -307,7 +305,7 @@ foreach my $rdb ( @db_desc ) { $rdb->{files} = [ @db_files ]; $rdb->{index} = [ @index_files ]; - my @hc_tables = map { "$db.$_" } @dbh_tables; + my @hc_tables = map { "`$db`.`$_`" } @dbh_tables; $rdb->{tables} = [ @hc_tables ]; $rdb->{raid_dirs} = [ get_raid_dirs( $rdb->{files} ) ]; @@ -562,14 +560,14 @@ sub copy_files { # add recursive option for scp push @cp, "-r" if $^O =~ /m^(solaris|linux|freebsd)$/ && $method =~ /^scp\b/; - my @non_raid = grep { ! m:/\d{2}/[^/]+$: } @$files; + my @non_raid = map { "'$_'" } grep { ! m:/\d{2}/[^/]+$: } @$files; # add files to copy and the destination directory - safe_system( @cp, @non_raid, $target ); ++ safe_system( @cp, @non_raid, "'$target'" ); foreach my $rd ( @$raid_dirs ) { - my @raid = grep { m:$rd/: } @$files; - safe_system( @cp, @raid, "$target/$rd" ) if ( @raid ); + my @raid = map { "'$_'" } grep { m:$rd/: } @$files; + safe_system( @cp, @raid, "'$target'/$rd" ) if ( @raid ); } } else @@ -735,6 +733,25 @@ sub get_raid_dirs { return sort keys %dirs; } +sub get_list_of_tables { + my ( $db ) = @_; + + # "use database" cannot cope with database names containing spaces + # so create a new connection + + my $dbh = DBI->connect("dbi:mysql:${db}${dsn};mysql_read_default_group=mysqlhotcopy", + $opt{user}, $opt{password}, + { + RaiseError => 1, + PrintError => 0, + AutoCommit => 1, + }); + + my @dbh_tables = eval { $dbh->tables() }; + $dbh->disconnect(); + return @dbh_tables; +} + __END__ =head1 DESCRIPTION @@ -975,3 +992,4 @@ Jeremy D. Zawodny - Removed depricated DBI calls. Fixed bug which resulted in nothing being copied when a regexp was specified but no database name(s). +Martin Waite - Fix to handle database name that contains space. -- cgit v1.2.1