Properly handle newlines in SQL comments

Signed-off-by: Michal Čihař <michal@cihar.com>
This commit is contained in:
Michal Čihař 2016-07-13 09:57:49 +02:00
parent 7f7a8ac467
commit 56e1350118

View File

@ -519,7 +519,14 @@ class ExportSql extends ExportPlugin
&& $GLOBALS['sql_include_comments']
) {
// see http://dev.mysql.com/doc/refman/5.0/en/ansi-diff-comments.html
return '--' . (empty($text) ? '' : ' ') . $text . $GLOBALS['crlf'];
if (empty($text)) {
return '--' . $GLOBALS['crlf'];
} else {
$lines = preg_split("/\\r\\n|\\r|\\n/", $text);
foreach ($lines as $line) {
return '-- ' . $line . $GLOBALS['crlf'];
}
}
} else {
return '';
}