On Fri, Jul 20, 2001 at 01:25:22AM -0700, Jeremy Zawodny wrote:
> > 
> > If I specify just one database, I still get the "deprecated"
> > warning, but the hotcopy works...
> 
> There are two bugs.
> 
>   (1) The "depricated" message.  I'm submitting a patch for that.
> 
>   (2) The fact that if you specify no databases but do specify a
>       regexp, it doesn't do what you expect.  It is unclear to me,
>       based on the docs for mysqlhotcopy, what it is supposed to do in
>       that case.  But I'm leaning toward thinking that your
>       expectations are right.  I'll put that in the patch as well.

The patch against scripts/mysqlhotcopy.sh from the latest bitkeeper
source tree is below my signature.  I tested it using your example and
it seemed to solve the problems for me.

Jeremy
-- 
Jeremy D. Zawodny, <[EMAIL PROTECTED]>
Technical Yahoo - Yahoo Finance
Desk: (408) 349-7878   Fax: (408) 349-5454   Cell: (408) 685-5936 <-- NEW

MySQL 3.23.29: up 34 days, processed 268,910,584 queries (89/sec. avg)



--- mysqlhotcopy.sh.orig        Fri Jul 20 00:51:17 2001
+++ mysqlhotcopy.sh     Fri Jul 20 02:11:06 2001
@@ -223,18 +223,27 @@
     my $db = $rdb->{src};
     eval { $dbh->do( "use $db" ); };
     die "Database '$db' not accessible: $@"  if ( $@ );
-    my @dbh_tables = $dbh->func( '_ListTables' );
+    my @dbh_tables = $dbh->tables();
 
     ## generate regex for tables/files
-    my $t_regex = $rdb->{t_regex};        ## assign temporary regex
-    my $negated = $t_regex =~ tr/~//d;    ## remove and count negation operator: we 
don't allow ~ in table names
-    $t_regex = qr/$t_regex/;              ## make regex string from user regex
-
-    ## filter (out) tables specified in t_regex
-    print "Filtering tables with '$t_regex'\n" if $opt{debug};
-    @dbh_tables = ( $negated 
-                   ? grep { $_ !~ $t_regex } @dbh_tables 
-                   : grep { $_ =~ $t_regex } @dbh_tables );
+    my $t_regex;
+    my $negated;
+    if ($rdb->{t_regex}) {
+        $t_regex = $rdb->{t_regex};        ## assign temporary regex
+        $negated = $t_regex =~ tr/~//d;    ## remove and count
+                                           ## negation operator: we
+                                           ## don't allow ~ in table
+                                           ## names
+
+        $t_regex = qr/$t_regex/;           ## make regex string from
+                                           ## user regex
+
+        ## filter (out) tables specified in t_regex
+        print "Filtering tables with '$t_regex'\n" if $opt{debug};
+        @dbh_tables = ( $negated 
+                        ? grep { $_ !~ $t_regex } @dbh_tables
+                        : grep { $_ =~ $t_regex } @dbh_tables );
+    }
 
     ## get list of files to copy
     my $db_dir = "$datadir/$db";
@@ -249,10 +258,18 @@
     closedir( DBDIR );
 
     ## filter (out) files specified in t_regex
-    my @db_files = ( $negated 
-                         ? grep { $db_files{$_} !~ $t_regex } keys %db_files
-                         : grep { $db_files{$_} =~ $t_regex } keys %db_files );
+    my @db_files;
+    if ($rdb->{t_regex}) {
+        @db_files = ($negated
+                     ? grep { $db_files{$_} !~ $t_regex } keys %db_files
+                     : grep { $db_files{$_} =~ $t_regex } keys %db_files );
+    }
+    else {
+        @db_files = keys %db_files;
+    }
+
     @db_files = sort @db_files;
+
     my @index_files=();
 
     ## remove indices unless we're told to keep them
@@ -808,4 +825,8 @@
 Ask Bjoern Hansen - Cleanup code to fix a few bugs and enable -w again.
 
 Emil S. Hansen - Added resetslave and resetmaster.
+
+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).
 

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <mysql-unsubscribe-##L=##[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to