From: Rafael Kitover Date: Wed, 12 Oct 2011 15:15:12 +0000 (-0400) Subject: use full table name for MySQL key cache X-Git-Tag: 0.07011~34 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FDBIx-Class-Schema-Loader.git;a=commitdiff_plain;h=0a4273b7ec460eecf7abf6d6c9cc673c75950d2b use full table name for MySQL key cache 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. --- diff --git a/lib/DBIx/Class/Schema/Loader/DBI/mysql.pm b/lib/DBIx/Class/Schema/Loader/DBI/mysql.pm index b474336..8deaf4e 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/mysql.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/mysql.pm @@ -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 {