bug #1550690, wrong export of constraints
This commit is contained in:
@@ -9,6 +9,8 @@ $Source$
|
||||
### 2.9.0.1 released from MAINT_2_9_0
|
||||
* tbl_relation.php: trap error 1452 when adding a foreign key
|
||||
and a constraint fails
|
||||
* libraries/export/sql.php: bug #1550690, wrong export of constraints,
|
||||
thanks to Robert Vock
|
||||
|
||||
2006-09-29 Marc Delisle <lem9@users.sourceforge.net>
|
||||
* libraries/database_interface.lib.php, bug #1566904, typo in require,
|
||||
|
@@ -461,6 +461,7 @@ function PMA_getTableDef($db, $table, $crlf, $error_url, $show_dates = false)
|
||||
|
||||
// let's do the work
|
||||
$sql_constraints_query .= 'ALTER TABLE ' . PMA_backquote($table) . $crlf;
|
||||
$sql_constraints .= 'ALTER TABLE ' . PMA_backquote($table) . $crlf;
|
||||
|
||||
$first = TRUE;
|
||||
for ($j = $i; $j < $sql_count; $j++) {
|
||||
@@ -469,11 +470,13 @@ function PMA_getTableDef($db, $table, $crlf, $error_url, $show_dates = false)
|
||||
$sql_constraints .= $crlf;
|
||||
}
|
||||
if (strpos($sql_lines[$j], 'CONSTRAINT') === FALSE) {
|
||||
$sql_constraints_query .= preg_replace('/(FOREIGN[\s]+KEY)/', 'ADD \1', $sql_lines[$j]);
|
||||
$sql_constraints .= $sql_constraints_query;
|
||||
$str_tmp = preg_replace('/(FOREIGN[\s]+KEY)/', 'ADD \1', $sql_lines[$j]);
|
||||
$sql_constraints_query .= $str_tmp;
|
||||
$sql_constraints .= $str_tmp;
|
||||
} else {
|
||||
$sql_constraints_query .= preg_replace('/(CONSTRAINT)/', 'ADD \1', $sql_lines[$j]);
|
||||
$sql_constraints .= $sql_constraints_query;
|
||||
$str_tmp = preg_replace('/(CONSTRAINT)/', 'ADD \1', $sql_lines[$j]);
|
||||
$sql_constraints_query .= $str_tmp;
|
||||
$sql_constraints .= $str_tmp;
|
||||
}
|
||||
$first = FALSE;
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user