From d5a3b01f77c5efbfbb8a8bb328dd9272ff7170c2 Mon Sep 17 00:00:00 2001 From: Viduranga Wijesooriya Date: Thu, 16 Jan 2014 14:50:31 +0530 Subject: [PATCH] fixed #4235 Copy table causes SQL error Signed-off-by: Viduranga Wijesooriya --- libraries/plugins/export/ExportSql.class.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libraries/plugins/export/ExportSql.class.php b/libraries/plugins/export/ExportSql.class.php index 344c73484d..9070b468e5 100644 --- a/libraries/plugins/export/ExportSql.class.php +++ b/libraries/plugins/export/ExportSql.class.php @@ -1185,15 +1185,15 @@ class ExportSql extends ExportPlugin //are there any constraints to cut out? if (preg_match('@CONSTRAINT|KEY@', $create_query)) { - $has_constraints=0; - $has_indexes=0; + $has_constraints = 0; + $has_indexes = 0; //if there are constraints if (preg_match( '@CONSTRAINT@', $create_query )) { - $has_constraints=1; + $has_constraints = 1; // comments -> constraints for dumped tables if (! isset($sql_constraints)) { if (isset($GLOBALS['no_constraints_comments'])) { @@ -1231,10 +1231,10 @@ class ExportSql extends ExportPlugin } //if there are indexes if (preg_match( - '@KEY@', + '@KEY+[\s]@', $create_query )) { - $has_indexes=1; + $has_indexes = 1; // comments -> indexes for dumped tables if (! isset($sql_indexes)) { @@ -1390,7 +1390,7 @@ class ExportSql extends ExportPlugin } $first = false; } else if (preg_match( - '@KEY@', + '@KEY+[\s]@', $sql_lines[$j] )) { //if it's a index @@ -1402,8 +1402,8 @@ class ExportSql extends ExportPlugin } } //removes superfluous comma at the end - $sql_indexes=rtrim($sql_indexes, ','); - $sql_indexes_query=rtrim($sql_indexes_query, ','); + $sql_indexes = rtrim($sql_indexes, ','); + $sql_indexes_query = rtrim($sql_indexes_query, ','); //removes superfluous semicolon at the end if ($has_constraints == 1) { $sql_constraints .= ';' . $crlf;