From: Dagfinn Ilmari Mannsåker Date: Fri, 15 Nov 2013 17:38:17 +0000 (+0000) Subject: Fix MySQL column info detection with multiple schemas (RT#82358) X-Git-Tag: 0.07038~7 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=55bcfd1a5f954b63fa036f69004e8839df8c36a6;p=dbsrgits%2FDBIx-Class-Schema-Loader.git Fix MySQL column info detection with multiple schemas (RT#82358) Specifically, if similarly-named tables exist in multiple schemas, we might get the column info for the wrong one. --- diff --git a/Changes b/Changes index d89ec66..cd11a9d 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,7 @@ Revision history for Perl extension DBIx::Class::Schema::Loader - Allow coderef maps to call back into the hashref mapping code + - Fix MySQL column info detection with multiple schemas (RT#82358) 0.07037 2013-10-30 - Allow overriding individual moniker parts diff --git a/lib/DBIx/Class/Schema/Loader/DBI/mysql.pm b/lib/DBIx/Class/Schema/Loader/DBI/mysql.pm index a5384b1..ae8f5f0 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/mysql.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/mysql.pm @@ -233,7 +233,7 @@ sub _columns_info_for { my ($precision, $scale, $column_type, $default) = eval { $self->dbh->selectrow_array(<<'EOF', {}, $table->name, lc($col)) }; SELECT numeric_precision, numeric_scale, column_type, column_default FROM information_schema.columns -WHERE table_name = ? AND lower(column_name) = ? +WHERE table_schema = schema() AND table_name = ? AND lower(column_name) = ? EOF my $has_information_schema = not $@;