diff --git a/ChangeLog b/ChangeLog index f44f41b8e3..29f8b4d23b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,7 @@ phpMyAdmin - ChangeLog - bug #4905 Sorting by an alias - bug #4931 False error before entering reCAPTCHA - bug #4909 central column with multiple server +- bug #4937 Custom export with backquotes off is not working 4.4.8.0 (2015-05-28) - bug Allow accessing visual query builder when pmadb is not configured diff --git a/libraries/plugins/export/ExportSql.class.php b/libraries/plugins/export/ExportSql.class.php index 91227abcd8..629949adb1 100644 --- a/libraries/plugins/export/ExportSql.class.php +++ b/libraries/plugins/export/ExportSql.class.php @@ -1443,11 +1443,33 @@ class ExportSql extends ExportPlugin $sql_lines[$j], 'CONSTRAINT' ); + $tmp_str = $sql_lines[$j]; + if (! $sql_backquotes) { + $matches = array(); + $matched = preg_match( + '/REFERENCES[\s]([\S]*)[\s]\(([\S]*)\)/', + $tmp_str, + $matches + ); + if ($matched) { + $refTable = PMA_Util::backquoteCompat( + $matches[1], $compat, $sql_backquotes + ); + $refColumn = PMA_Util::backquoteCompat( + $matches[2], $compat, $sql_backquotes + ); + $tmp_str = preg_replace( + '/REFERENCES[\s]([\S]*)[\s]\(([\S]*)\)/', + 'REFERENCES ' . $refTable . ' (' . $refColumn . ')', + $tmp_str + ); + } + } if ($posConstraint === false) { $tmp_str = preg_replace( '/(FOREIGN[\s]+KEY)/', ' ADD \1', - $sql_lines[$j] + $tmp_str ); $sql_constraints_query .= $tmp_str; @@ -1457,7 +1479,7 @@ class ExportSql extends ExportPlugin $tmp_str = preg_replace( '/(CONSTRAINT)/', ' ADD \1', - $sql_lines[$j] + $tmp_str ); $sql_constraints_query .= $tmp_str;