From: Dagfinn Ilmari Mannsåker Date: Thu, 24 Jul 2014 16:34:54 +0000 (+0100) Subject: Fix handling of views in MySQL DBI parser X-Git-Tag: v0.11019~24 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=15128a246c63476afc397fda99064e3b450ee73a;hp=20ca8e38397ebb9b1bf0fb87928c9aacc3fd69dc;p=dbsrgits%2FSQL-Translator.git Fix handling of views in MySQL DBI parser SHOW TABLES and SHOW CREATE TABLE return views too, and Parser::MySQL handles them just fine, so just pass them on. --- diff --git a/Changes b/Changes index aaeb136..875951a 100644 --- a/Changes +++ b/Changes @@ -5,6 +5,7 @@ Changes for SQL::Translator * Fix Pg DBI parser test (Dagfinn Ilmari MannsÃ¥ker) * Remove spurious warnings (Matt Phillips, Wallace Reis) * Fix MySQL producer for columns with scalar ref in 'ON UPDATE' (Wallace Reis) + * Fix handling of views in MySQL DBI parser 0.11018 2013-10-31 🎃 diff --git a/lib/SQL/Translator/Parser/DBI/MySQL.pm b/lib/SQL/Translator/Parser/DBI/MySQL.pm index 3512fb7..7907690 100644 --- a/lib/SQL/Translator/Parser/DBI/MySQL.pm +++ b/lib/SQL/Translator/Parser/DBI/MySQL.pm @@ -43,7 +43,7 @@ sub parse { my $sth = $dbh->prepare("show create table $table_name"); $sth->execute; my $table = $sth->fetchrow_hashref; - $create .= $table->{'create table'} . ";\n\n"; + $create .= ($table->{'create table'} || $table->{'create view'}) . ";\n\n"; } SQL::Translator::Parser::MySQL::parse( $tr, $create );