summaryrefslogtreecommitdiff
path: root/scripts/mysqlhotcopy.sh
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2002-03-12 11:38:22 +0200
committerunknown <monty@hundin.mysql.fi>2002-03-12 11:38:22 +0200
commit4c221321b624e55238c641b515e24ad1091cdc93 (patch)
treec217663c9f7a4fba0c5a00acb72b3e980954f780 /scripts/mysqlhotcopy.sh
parentc13baf70ec937501389ed6e9f94c98635f1c1b76 (diff)
downloadmariadb-git-4c221321b624e55238c641b515e24ad1091cdc93.tar.gz
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
Diffstat (limited to 'scripts/mysqlhotcopy.sh')
-rw-r--r--scripts/mysqlhotcopy.sh36
1 files changed, 27 insertions, 9 deletions
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.