summaryrefslogtreecommitdiff
path: root/scripts/mysqlhotcopy.sh
diff options
context:
space:
mode:
authorjani@rhols221.adsl.netsonic.fi <>2003-10-22 16:02:27 +0300
committerjani@rhols221.adsl.netsonic.fi <>2003-10-22 16:02:27 +0300
commit07c9d4575bba8ac3c6b5d364f3a63890f46e6953 (patch)
treeba3c283aad656366dc7fa4943d8d3f1f5870704a /scripts/mysqlhotcopy.sh
parent08cafccec7e124209a22e32c0ffc840039ac1010 (diff)
downloadmariadb-git-07c9d4575bba8ac3c6b5d364f3a63890f46e6953.tar.gz
Applied a patch from Travis Wheeler to mysqlhotcopy that allows
using regexp with tablenames together with databasenames.
Diffstat (limited to 'scripts/mysqlhotcopy.sh')
-rw-r--r--scripts/mysqlhotcopy.sh17
1 files changed, 15 insertions, 2 deletions
diff --git a/scripts/mysqlhotcopy.sh b/scripts/mysqlhotcopy.sh
index f23955da06a..3e53af32653 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.19";
+my $VERSION = "1.20";
my $opt_tmpdir = $ENV{TMPDIR} || "/tmp";
@@ -235,10 +235,15 @@ else
# --- resolve database names from regexp ---
if ( defined $opt{regexp} ) {
+ my $t_regex = '.*';
+ if ( $opt{regexp} =~ s{^/(.+)/\./(.+)/$}{$1} ) {
+ $t_regex = $2;
+ }
+
my $sth_dbs = $dbh->prepare("show databases");
$sth_dbs->execute;
while ( my ($db_name) = $sth_dbs->fetchrow_array ) {
- push @db_desc, { 'src' => $db_name } if ( $db_name =~ m/$opt{regexp}/o );
+ push @db_desc, { 'src' => $db_name, 't_regex' => $t_regex } if ( $db_name =~ m/$opt{regexp}/o );
}
}
@@ -938,6 +943,14 @@ server in a mutual replication setup.
Copy all databases with names matching the pattern
+=item --regexp /pattern1/./pattern2/
+
+Copy all tables with names matching pattern2 from all databases with
+names matching pattern1. For example, to select all tables which
+names begin with 'bar' from all databases which names end with 'foo':
+
+ mysqlhotcopy --indices --method=cp --regexp /foo$/./^bar/
+
=item db_name./pattern/
Copy only tables matching pattern. Shell metacharacters ( (, ), |, !,