From 364b26b0dd783cbcc2b1be2113d2cf8cfbde1931 Mon Sep 17 00:00:00 2001 From: Andrea Vallorani Date: Tue, 17 Mar 2015 18:15:13 +0100 Subject: [PATCH] Bug #4798 Missing column when exporting in sql (2) Export failure when the comments contains reserved keywords (KEY, CONSTRAINT) To resolve, I removed the SQL comment from the current line before checking the presence of reserved keywords. Signed-off-by: Andrea Vallorani --- libraries/plugins/export/ExportSql.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libraries/plugins/export/ExportSql.class.php b/libraries/plugins/export/ExportSql.class.php index 9f1ebb72d9..fcdc52dd77 100644 --- a/libraries/plugins/export/ExportSql.class.php +++ b/libraries/plugins/export/ExportSql.class.php @@ -1435,9 +1435,10 @@ class ExportSql extends ExportPlugin // lets find first line with constraints $first_occur = -1; for ($i = 0; $i < $sql_count; $i++) { + $sql_line = current(explode(' COMMENT ', $sql_lines[$i], 2)); if (preg_match( '@[\s]+(CONSTRAINT|KEY)@', - $sql_lines[$i] + $sql_line ) && $first_occur == -1) { $first_occur = $i; }