Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/QA_4_5' into QA_4_5
Browse files Browse the repository at this point in the history
  • Loading branch information
weblate committed Sep 30, 2015
2 parents a983abf + 6adb719 commit e3ef68c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Expand Up @@ -14,6 +14,7 @@ phpMyAdmin - ChangeLog
- issue #11505 Notice on htmlspecialchars()
- issue Notice in Structure page of views
- issue #11510 AUTO_INCREMENT always exported when IF NOT EXISTS is on
- issue #11516 Some partitions are missing in copied table

4.5.0.2 (2015-09-25)
- issue #11497 Incorrect indexes when exporting
Expand Down
17 changes: 12 additions & 5 deletions libraries/sql-parser/src/Components/PartitionDefinition.php
Expand Up @@ -36,7 +36,7 @@ class PartitionDefinition extends Component
* @var array
*/
public static $OPTIONS = array(
'STORAGE' => array(1, 'var'),
'ENGINE' => array(1, 'var'),
'STORAGE ENGINE' => array(1, 'var'),
'COMMENT' => array(2, 'var'),
'DATA DIRECTORY' => array(3, 'var'),
Expand Down Expand Up @@ -108,6 +108,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
* 0 -------------[ PARTITION | SUBPARTITION ]------------> 1
*
* 1 -----------------------[ name ]----------------------> 2
* 1 -----------------------[ name ]----------------------> 5
*
* 2 ----------------------[ VALUES ]---------------------> 3
*
Expand Down Expand Up @@ -148,7 +149,12 @@ public static function parse(Parser $parser, TokensList $list, array $options =
$state = 1;
} elseif ($state === 1) {
$ret->name = $token->value;
$state = $ret->isSubpartition ? 5 : 2;
// Get next token
$nextToken = $list->getNext();
$nextToken = $list->getNext();
--$list->idx; --$list->idx; // Reset index
$isValue = ($nextToken->type === Token::TYPE_KEYWORD) && ($nextToken->value === 'VALUES');
$state = $isValue ? 2 : 5;
} elseif ($state === 2) {
$state = 3;
} elseif ($state === 3) {
Expand Down Expand Up @@ -202,13 +208,14 @@ public static function build($component, array $options = array())
return "(\n" . implode(",\n", $component) . "\n)";
} else {
if ($component->isSubpartition) {
return 'SUBPARTITION ' . $component->name;
return 'SUBPARTITION ' . $component->name . ' ' . $component->options;
} else {
$subpartitions = empty($component->subpartitions)
? '' : ' ' . PartitionDefinition::build($component->subpartitions);
return 'PARTITION ' . $component->name
. ' VALUES ' . $component->type . ' ' . $component->expr
. $subpartitions;
. (empty($component->type)
? ' ' : ' VALUES ' . $component->type . ' ' . $component->expr)
. $component->options . $subpartitions;
}
}
}
Expand Down

0 comments on commit e3ef68c

Please sign in to comment.