fixed #4235 Copy table causes SQL error
Signed-off-by: Viduranga Wijesooriya <vpowerrc@gmail.com>
This commit is contained in:
parent
ad21cf07bd
commit
d5a3b01f77
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user