Fix handling of multi column foreign keys (bug #946861).
This commit is contained in:
@@ -8,6 +8,8 @@ $Source$
|
||||
2004-05-04 Michal Cihar <michal@cihar.com>
|
||||
* libraries/sqlparser.data.php: Add ENGINE to reserved words (used instead
|
||||
of TYPE in MySQL 4.1.1).
|
||||
* libraries/export/sql.php: Fix handling of multi column foreign keys (bug
|
||||
#946861).
|
||||
|
||||
2004-05-04 Garvin Hicking <pma@supergarv.de>
|
||||
* Documentation.html, config.inc.php, left.php: Use NaturalOrder
|
||||
|
@@ -261,7 +261,7 @@ function PMA_getTableDef($db, $table, $crlf, $error_url, $show_dates = false)
|
||||
$tmpres[1] = preg_replace('/^CREATE TABLE/', 'CREATE TABLE IF NOT EXISTS', $tmpres[1]);
|
||||
}
|
||||
|
||||
if (preg_match_all('((,\r?\n[\s]*(CONSTRAINT|FOREIGN[\s]*KEY)[^\r\n,]+)+)', $tmpres[1], $regs)) {
|
||||
if (preg_match_all('((,\r?\n[\s]*(CONSTRAINT|FOREIGN[\s]*KEY)[^\r\n]+)+)', $tmpres[1], $regs)) {
|
||||
if (!isset($sql_constraints)) {
|
||||
if (isset($GLOBALS['no_constraints_comments'])) {
|
||||
$sql_constraints = '';
|
||||
@@ -277,7 +277,7 @@ function PMA_getTableDef($db, $table, $crlf, $error_url, $show_dates = false)
|
||||
$sql_constraints .= 'ALTER TABLE ' . PMA_backquote($table) . $crlf
|
||||
. preg_replace('/(,\r?\n|^)([\s]*)(CONSTRAINT|FOREIGN[\s]*KEY)/', '\1\2ADD \3', substr($regs[0][0], 2))
|
||||
. ";\n";
|
||||
$tmpres[1] = preg_replace('((,\r?\n[\s]*(CONSTRAINT|FOREIGN[\s]*KEY)[^\r\n,]+)+)', '', $tmpres[1]);
|
||||
$tmpres[1] = preg_replace('((,\r?\n[\s]*(CONSTRAINT|FOREIGN[\s]*KEY)[^\r\n]+)+)', '', $tmpres[1]);
|
||||
}
|
||||
$schema_create .= $tmpres[1];
|
||||
}
|
||||
|
Reference in New Issue
Block a user