bug #4937 Custom export with backquotes off is not working

Signed-off-by: Madhura Jayaratne <madhura.cj@gmail.com>
This commit is contained in:
Madhura Jayaratne 2015-06-02 14:40:25 +05:30
parent a89d849647
commit cd2ee14a7c
2 changed files with 25 additions and 2 deletions

View File

@ -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

View File

@ -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;