From: Jaime Soriano Pastor Date: Mon, 14 Nov 2011 10:36:08 +0000 (+0100) Subject: MySQL parsing fails if a table is defined more than once in the same file, if not... X-Git-Tag: v0.11011~59 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=22529e3659302b48490343027ef560a1551e21ab;p=dbsrgits%2FSQL-Translator.git MySQL parsing fails if a table is defined more than once in the same file, if not, indices are messed up --- diff --git a/Changes b/Changes index ee490e2..da96e37 100644 --- a/Changes +++ b/Changes @@ -11,6 +11,8 @@ fix by not adding the ON DELETE/UPDATE clause at all * Changed dependency on Digest::SHA1 to the core-bundled Digest::SHA (RT#67989) * Support for double quoted and bit strings as default values in MySQL parser +* Check in MySQL parser to avoid trying to parse a table defined twice in the same + file as indices (and probably other things) get messed up # ---------------------------------------------------------- # 0.11010 2011-10-05 diff --git a/lib/SQL/Translator/Parser/MySQL.pm b/lib/SQL/Translator/Parser/MySQL.pm index 0da058b..f7f2a45 100644 --- a/lib/SQL/Translator/Parser/MySQL.pm +++ b/lib/SQL/Translator/Parser/MySQL.pm @@ -247,6 +247,9 @@ create : CREATE /database/i WORD "$delimiter" create : CREATE TEMPORARY(?) TABLE opt_if_not_exists(?) table_name '(' create_definition(s /,/) /(,\s*)?\)/ table_option(s?) "$delimiter" { my $table_name = $item{'table_name'}; + die "There is more than one definition for $table_name" + if ($tables{$table_name}); + $tables{ $table_name }{'order'} = ++$table_order; $tables{ $table_name }{'table_name'} = $table_name;