List:Commits« Previous MessageNext Message »
From:tim Date:August 15 2007 9:35am
Subject:bk commit into 5.0 tree (tsmith:1.2513) BUG#27694
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of tsmith. When tsmith does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-08-15 01:35:38-06:00, tsmith@stripped +1 -0
  Bug #27694: mysqlhotcopy & p5-DBD-mysql51-4.003
  
  The symptom is that, when used with recent versions of DBD::mysql,
  mysqlhotcopy uses a double-qualified table name, for example:
  
  Invalid db.table name 'test.test`.`x' at /usr/bin/mysqlhotcopy line 855.
  
  This is caused by a change in DBD::mysql.  See this diff:
  
  http://svn.perl.org/viewcvs/modules/DBD-mysql/trunk/lib/DBD/mysql.pm?r1=9183&r2=9188
  
  Basically, older DBD::mysql implemented a limited ->table_info method;
  now the full method is implemented, and as a result DBI's ->tables()
  method has access to the schema value, so it uses it.

  scripts/mysqlhotcopy.sh@stripped, 2007-08-15 01:35:37-06:00, tsmith@stripped +2
-23
    Use $dbh->table_info() instead of $dbh->tables() in
    get_list_of_tables().  DBI's ->tables() method calls
    ->table_info() under the hood, and then quotes the
    names and (depending on DBI version) adds the schema
    name, too.  mysqlhotcopy doesn't want the schema name
    or the quotes, so it's all around better to just call
    ->table_info() itself.

diff -Nrup a/scripts/mysqlhotcopy.sh b/scripts/mysqlhotcopy.sh
--- a/scripts/mysqlhotcopy.sh	2006-10-03 01:05:31 -06:00
+++ b/scripts/mysqlhotcopy.sh	2007-08-15 01:35:37 -06:00
@@ -821,30 +821,9 @@ sub get_raid_dirs {
 sub get_list_of_tables {
     my ( $db ) = @_;
 
-    # "use database" cannot cope with database names containing spaces
-    # so create a new connection 
+    my $tables = eval { $dbh->table_info(undef, $db)->fetchall_arrayref() } || [];
 
-    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() };
-
-    ## Remove quotes around table names
-    my $quote = $dbh->get_info(29); # SQL_IDENTIFIER_QUOTE_CHAR
-    if ($quote) {
-      foreach (@dbh_tables) {
-        s/^$quote(.*)$quote$/$1/;
-        s/$quote$quote/$quote/g;
-      }
-    }
-
-    $dbh->disconnect();
-    return @dbh_tables;
+    return (map { $_->[2] } @$tables);
 }
 
 sub quote_names {
Thread
bk commit into 5.0 tree (tsmith:1.2513) BUG#27694tim15 Aug