use full table name for MySQL key cache
Rafael Kitover [Wed, 12 Oct 2011 15:15:12 +0000 (11:15 -0400)]
Primary/unique key cache now caches by $table->sql_name instead of
$table.

Failure to do so returned the wrong keys for the same table name in
multi-db_schema dumps.

lib/DBIx/Class/Schema/Loader/DBI/mysql.pm

index b474336..8deaf4e 100644 (file)
@@ -143,7 +143,7 @@ sub _table_fk_info {
 sub _mysql_table_get_keys {
     my ($self, $table) = @_;
 
-    if(!exists($self->{_cache}->{_mysql_keys}->{$table})) {
+    if(!exists($self->{_cache}->{_mysql_keys}->{$table->sql_name})) {
         my %keydata;
         my $sth = $self->dbh->prepare('SHOW INDEX FROM '.$table->sql_name);
         $sth->execute;
@@ -158,10 +158,10 @@ sub _mysql_table_get_keys {
                 @{$keydata{$keyname}};
             $keydata{$keyname} = \@ordered_cols;
         }
-        $self->{_cache}->{_mysql_keys}->{$table} = \%keydata;
+        $self->{_cache}->{_mysql_keys}->{$table->sql_name} = \%keydata;
     }
 
-    return $self->{_cache}->{_mysql_keys}->{$table};
+    return $self->{_cache}->{_mysql_keys}->{$table->sql_name};
 }
 
 sub _table_pk_info {