Subject: | Field comments with embedded ' aren't recognised properly |
Some of our tables have definitions like:
CREATE TABLE table_name (
`ID` int(11) COMMENT 'text ''quoted text'' more text',
`keyword` text NOT NULL,
etc
Note the quoted text in the comment.
The grammar for field comments doesn't allow embedded ' in comments, and
so it doesn't recognise the above as a valid field definition.
The patch below (against 0.08001) solves this problem
--- lib/SQL/Translator/Parser/MySQL.pm.orig 2007-09-26
15:11:16.000000000 +0100
+++ lib/SQL/Translator/Parser/MySQL.pm 2007-11-28 14:50:46.000000000 +0000
@@ -370,7 +370,7 @@
}
-field_comment2 : /comment/i /'.*?'/
+field_comment2 : /comment/i /'.*?(?<!')'(?!')/
{
my $comment = $item[2];
$comment =~ s/^'//;