Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2015-09-25 13:23:43 +02:00
commit 78e44d7d3e
4 changed files with 50 additions and 7 deletions

View File

@ -15,6 +15,9 @@ phpMyAdmin - ChangeLog
- issue #11495 'PMA_Microhistory' is undefined
- issue #11496 Incorrect definition for getTablesWhenOpen()
4.5.0.2 (2015-09-25)
- issue #11497 Incorrect indexes when exporting
4.5.0.1 (2015-09-24)
- issue #11492 AUTO_INCREMENT statements are partly missing from exports

View File

@ -2574,9 +2574,9 @@ class ExportSql extends ExportPlugin
// Key's columns.
if (!empty($field->key)) {
foreach ($field->key->columns as $key => $column) {
if (!empty($aliases[$old_database]['tables'][$old_table]['columns'][$column])) {
$field->key->columns[$key] = $aliases[$old_database]
['tables'][$old_table]['columns'][$column];
if (!empty($aliases[$old_database]['tables'][$old_table]['columns'][$column['name']])) {
$field->key->columns[$key]['name'] = $aliases[$old_database]
['tables'][$old_table]['columns'][$column['name']];
$flag = true;
}
}

View File

@ -95,6 +95,13 @@ class Key extends Component
{
$ret = new Key();
/**
* Last parsed column.
*
* @var array
*/
$lastColumn = array();
/**
* The state of the parser.
*
@ -135,12 +142,31 @@ class Key extends Component
$state = 1;
} elseif ($state === 1) {
if (($token->type === Token::TYPE_OPERATOR) && ($token->value === '(')) {
$ret->columns = ArrayObj::parse($parser, $list)->values;
$state = 2;
} else {
$ret->name = $token->value;
}
} elseif ($state === 2) {
if ($token->type === Token::TYPE_OPERATOR) {
if ($token->value === '(') {
$state = 3;
} elseif (($token->value === ',') || ($token->value === ')')) {
$state = ($token->value === ',') ? 2 : 4;
if (!empty($lastColumn)) {
$ret->columns[] = $lastColumn;
$lastColumn = array();
}
}
} else {
$lastColumn['name'] = $token->value;
}
} elseif ($state === 3) {
if (($token->type === Token::TYPE_OPERATOR) && ($token->value === ')')) {
$state = 2;
} else {
$lastColumn['length'] = $token->value;
}
} elseif ($state === 4) {
$ret->options = OptionsArray::parse($parser, $list, static::$KEY_OPTIONS);
++$list->idx;
break;
@ -163,8 +189,17 @@ class Key extends Component
if (!empty($component->name)) {
$ret .= Context::escape($component->name) . ' ';
}
$ret .= '(' . implode(',', Context::escape($component->columns)) . ') '
. $component->options;
$columns = array();
foreach ($component->columns as $column) {
$tmp = Context::escape($column['name']);
if (isset($column['length'])) {
$tmp .= '(' . $column['length'] . ')';
}
$columns[] = $tmp;
}
$ret .= '(' . implode(',', $columns) . ') ' . $component->options;
return trim($ret);
}
}

View File

@ -45,9 +45,14 @@ class Table
continue;
}
$columns = array();
foreach ($field->key->columns as $column) {
$columns[] = $column['name'];
}
$tmp = array(
'constraint' => $field->name,
'index_list' => $field->key->columns,
'index_list' => $columns,
);
if (!empty($field->references)) {