Commit bb27133c authored by jani@rhols221.adsl.netsonic.fi's avatar jani@rhols221.adsl.netsonic.fi

Merge work:/home/bk/mysql-4.0

into rhols221.adsl.netsonic.fi:/home/my/bk/mysql-4.0
parents c9cb735f 7dc6d7bd
...@@ -37,7 +37,7 @@ WARNING: THIS PROGRAM IS STILL IN BETA. Comments/patches welcome. ...@@ -37,7 +37,7 @@ WARNING: THIS PROGRAM IS STILL IN BETA. Comments/patches welcome.
# Documentation continued at end of file # Documentation continued at end of file
my $VERSION = "1.17"; my $VERSION = "1.18";
my $opt_tmpdir = $ENV{TMPDIR} || "/tmp"; my $opt_tmpdir = $ENV{TMPDIR} || "/tmp";
...@@ -173,6 +173,7 @@ my $dbh = DBI->connect("dbi:mysql:$dsn;mysql_read_default_group=mysqlhotcopy", ...@@ -173,6 +173,7 @@ my $dbh = DBI->connect("dbi:mysql:$dsn;mysql_read_default_group=mysqlhotcopy",
# --- check that checkpoint table exists if specified --- # --- check that checkpoint table exists if specified ---
if ( $opt{checkpoint} ) { if ( $opt{checkpoint} ) {
$opt{checkpoint} = quote_names( $opt{checkpoint} );
eval { $dbh->do( qq{ select time_stamp, src, dest, msg eval { $dbh->do( qq{ select time_stamp, src, dest, msg
from $opt{checkpoint} where 1 != 1} ); from $opt{checkpoint} where 1 != 1} );
}; };
...@@ -183,6 +184,8 @@ if ( $opt{checkpoint} ) { ...@@ -183,6 +184,8 @@ if ( $opt{checkpoint} ) {
# --- check that log_pos table exists if specified --- # --- check that log_pos table exists if specified ---
if ( $opt{record_log_pos} ) { if ( $opt{record_log_pos} ) {
$opt{record_log_pos} = quote_names( $opt{record_log_pos} );
eval { $dbh->do( qq{ select host, time_stamp, log_file, log_pos, master_host, master_log_file, master_log_pos eval { $dbh->do( qq{ select host, time_stamp, log_file, log_pos, master_host, master_log_file, master_log_pos
from $opt{record_log_pos} where 1 != 1} ); from $opt{record_log_pos} where 1 != 1} );
}; };
...@@ -309,7 +312,7 @@ foreach my $rdb ( @db_desc ) { ...@@ -309,7 +312,7 @@ foreach my $rdb ( @db_desc ) {
$rdb->{files} = [ @db_files ]; $rdb->{files} = [ @db_files ];
$rdb->{index} = [ @index_files ]; $rdb->{index} = [ @index_files ];
my @hc_tables = map { "`$db`.`$_`" } @dbh_tables; my @hc_tables = map { quote_names("$db.$_") } @dbh_tables;
$rdb->{tables} = [ @hc_tables ]; $rdb->{tables} = [ @hc_tables ];
$rdb->{raid_dirs} = [ get_raid_dirs( $rdb->{files} ) ]; $rdb->{raid_dirs} = [ get_raid_dirs( $rdb->{files} ) ];
...@@ -569,7 +572,7 @@ sub copy_files { ...@@ -569,7 +572,7 @@ sub copy_files {
my @non_raid = map { "'$_'" } grep { ! m:/\d{2}/[^/]+$: } @$files; my @non_raid = map { "'$_'" } grep { ! m:/\d{2}/[^/]+$: } @$files;
# add files to copy and the destination directory # add files to copy and the destination directory
safe_system( @cp, @non_raid, "'$target'" ); safe_system( @cp, @non_raid, "'$target'" ) if (@non_raid);
foreach my $rd ( @$raid_dirs ) { foreach my $rd ( @$raid_dirs ) {
my @raid = map { "'$_'" } grep { m:$rd/: } @$files; my @raid = map { "'$_'" } grep { m:$rd/: } @$files;
...@@ -758,6 +761,16 @@ sub get_list_of_tables { ...@@ -758,6 +761,16 @@ sub get_list_of_tables {
return @dbh_tables; return @dbh_tables;
} }
sub quote_names {
my ( $name ) = @_;
# given a db.table name, add quotes
my ($db, $table, @cruft) = split( /\./, $name );
die "Invalid db.table name '$name'" if (@cruft || !defined $db || !defined $table );
return "`$db`.`$table`";
}
__END__ __END__
=head1 DESCRIPTION =head1 DESCRIPTION
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment