mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-06 18:24:26 +08:00
Issue #1777: indicate functional key part in table editor with a different icon
This commit is contained in:
@ -97,6 +97,7 @@ type
|
|||||||
function IsUnique: Boolean;
|
function IsUnique: Boolean;
|
||||||
function IsFulltext: Boolean;
|
function IsFulltext: Boolean;
|
||||||
function IsSpatial: Boolean;
|
function IsSpatial: Boolean;
|
||||||
|
function IsExpression(KeyPart: Integer): Boolean;
|
||||||
procedure Modification(Sender: TObject);
|
procedure Modification(Sender: TObject);
|
||||||
function SQLCode(TableName: String=''): String;
|
function SQLCode(TableName: String=''): String;
|
||||||
property InsideCreateCode: Boolean read GetInsideCreateCode;
|
property InsideCreateCode: Boolean read GetInsideCreateCode;
|
||||||
@ -11168,6 +11169,11 @@ begin
|
|||||||
Result := IndexType = SPATIAL;
|
Result := IndexType = SPATIAL;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TTableKey.IsExpression(KeyPart: Integer): Boolean;
|
||||||
|
begin
|
||||||
|
Result := Columns[KeyPart].StartsWith('(');
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TTableKey.Modification(Sender: TObject);
|
procedure TTableKey.Modification(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
@ -11223,8 +11229,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
Result := Result + '(';
|
Result := Result + '(';
|
||||||
for i:=0 to Columns.Count-1 do begin
|
for i:=0 to Columns.Count-1 do begin
|
||||||
if Columns[i].StartsWith('(') then
|
if IsExpression(i) then
|
||||||
Result := Result + Columns[i] // Functional key part with expression wrapped in parentheses
|
Result := Result + Columns[i] // Don't quote functional key part
|
||||||
else
|
else
|
||||||
Result := Result + FConnection.QuoteIdent(Columns[i]);
|
Result := Result + FConnection.QuoteIdent(Columns[i]);
|
||||||
if (SubParts.Count > i) and (SubParts[i] <> '') then
|
if (SubParts.Count > i) and (SubParts[i] <> '') then
|
||||||
|
@ -1944,6 +1944,7 @@ procedure TfrmTableEditor.treeIndexesGetImageIndex(Sender: TBaseVirtualTree;
|
|||||||
var Ghosted: Boolean; var ImageIndex: TImageIndex);
|
var Ghosted: Boolean; var ImageIndex: TImageIndex);
|
||||||
var
|
var
|
||||||
VT: TVirtualStringTree;
|
VT: TVirtualStringTree;
|
||||||
|
TblKey: TTableKey;
|
||||||
begin
|
begin
|
||||||
// Icon image showing type of index
|
// Icon image showing type of index
|
||||||
VT := Sender as TVirtualStringTree;
|
VT := Sender as TVirtualStringTree;
|
||||||
@ -1951,7 +1952,13 @@ begin
|
|||||||
if not (Kind in [ikNormal, ikSelected]) then Exit;
|
if not (Kind in [ikNormal, ikSelected]) then Exit;
|
||||||
case VT.GetNodeLevel(Node) of
|
case VT.GetNodeLevel(Node) of
|
||||||
0: ImageIndex := FKeys[Node.Index].ImageIndex;
|
0: ImageIndex := FKeys[Node.Index].ImageIndex;
|
||||||
1: ImageIndex := 42;
|
1: begin
|
||||||
|
TblKey := FKeys[Node.Parent.Index];
|
||||||
|
if TblKey.IsExpression(Node.Index) then
|
||||||
|
ImageIndex := 13
|
||||||
|
else
|
||||||
|
ImageIndex := 42;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user