mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-26 19:20:17 +08:00
Fix wrong "DROP [index name]" clause when turning a normal key into a primary key. Fixes issue #2011.
This commit is contained in:
@ -2642,6 +2642,7 @@ begin
|
||||
if Key.Name = '' then Key.Name := rx.Match[2]; // PRIMARY
|
||||
Key.OldName := Key.Name;
|
||||
Key.IndexType := rx.Match[2];
|
||||
Key.OldIndexType := Key.IndexType;
|
||||
Key.Algorithm := rx.Match[7];
|
||||
if Key.IndexType = '' then Key.IndexType := 'KEY'; // KEY
|
||||
Key.Columns := Explode(',', rx.Match[5]);
|
||||
|
@ -70,7 +70,7 @@ type
|
||||
TTableKey = class(TObject)
|
||||
public
|
||||
Name, OldName: String;
|
||||
IndexType, Algorithm: String;
|
||||
IndexType, OldIndexType, Algorithm: String;
|
||||
Columns, SubParts: TStringList;
|
||||
Modified, Added: Boolean;
|
||||
constructor Create;
|
||||
|
@ -433,6 +433,8 @@ begin
|
||||
end;
|
||||
DeletedKeys.Clear;
|
||||
for i:=0 to FKeys.Count-1 do begin
|
||||
FKeys[i].OldName := FKeys[i].Name;
|
||||
FKeys[i].OldIndexType := FKeys[i].IndexType;
|
||||
FKeys[i].Added := False;
|
||||
FKeys[i].Modified := False;
|
||||
end;
|
||||
@ -563,7 +565,7 @@ begin
|
||||
for i:=0 to FKeys.Count-1 do begin
|
||||
Mainform.ProgressBarStatus.StepIt;
|
||||
if FKeys[i].Modified and (not FKeys[i].Added) then begin
|
||||
if FKeys[i].IndexType = PKEY then
|
||||
if FKeys[i].OldIndexType = PKEY then
|
||||
IndexSQL := 'PRIMARY KEY'
|
||||
else
|
||||
IndexSQL := 'INDEX ' + Mainform.Mask(FKeys[i].OldName);
|
||||
@ -1247,6 +1249,7 @@ begin
|
||||
TblKey.Name := 'Index '+IntToStr(FKeys.Count+1);
|
||||
TblKey.OldName := TblKey.Name;
|
||||
TblKey.IndexType := KEY;
|
||||
TblKey.OldIndexType := TblKey.IndexType;
|
||||
TblKey.Added := True;
|
||||
FKeys.Add(TblKey);
|
||||
Modification(Sender);
|
||||
|
Reference in New Issue
Block a user