Skip to content

Commit

Permalink
Fixed identification of unique indexes (#300)
Browse files Browse the repository at this point in the history
Unique indexes, excepted the first index in the list, were wrongly identified as non-unique.
  • Loading branch information
sebastien-fauvel authored and greenlion committed Jun 1, 2019
1 parent 28ff145 commit e0262c0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/PHPSQLParser/processors/CreateDefinitionProcessor.php
Expand Up @@ -155,7 +155,7 @@ public function process($tokens) {
break;

case 'UNIQUE':
if ($prevCategory === '' || $prevCategory === 'CONSTRAINT') {
if ($prevCategory === '' || $prevCategory === 'CONSTRAINT' || $prevCategory === 'INDEX_COL_LIST') {
// next one is KEY
$expr[] = array('expr_type' => ExpressionType::UNIQUE_IDX, 'base_expr' => $trim);
$currCategory = $upper;
Expand Down Expand Up @@ -415,4 +415,4 @@ public function process($tokens) {
return $result;
}
}
?>
?>

0 comments on commit e0262c0

Please sign in to comment.