mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-16 11:42:12 +08:00
Unify default sorting of database objects in tree and lists. Fixes issue #1799.
This commit is contained in:
@ -5672,7 +5672,7 @@ begin
|
|||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
// Compare Strings
|
// Compare Strings
|
||||||
Result := AnsiCompareText( CellText1, CellText2 );
|
Result := CompareText( CellText1, CellText2 );
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -3,7 +3,8 @@ unit mysql_connection;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, windows, mysql_api, mysql_structures, SynRegExpr, Contnrs, Generics.Collections, DateUtils, Types;
|
Classes, SysUtils, windows, mysql_api, mysql_structures, SynRegExpr, Contnrs, Generics.Collections, Generics.Defaults,
|
||||||
|
DateUtils, Types;
|
||||||
|
|
||||||
type
|
type
|
||||||
{ TDBObjectList and friends }
|
{ TDBObjectList and friends }
|
||||||
@ -19,6 +20,10 @@ type
|
|||||||
PDBObject = ^TDBObject;
|
PDBObject = ^TDBObject;
|
||||||
TDBObjectList = TObjectList<TDBObject>;
|
TDBObjectList = TObjectList<TDBObject>;
|
||||||
|
|
||||||
|
TDBObjectComparer = class(TComparer<TDBObject>)
|
||||||
|
function Compare(const Left, Right: TDBObject): Integer; override;
|
||||||
|
end;
|
||||||
|
|
||||||
{$M+} // Needed to add published properties
|
{$M+} // Needed to add published properties
|
||||||
|
|
||||||
{ TConnectionParameters }
|
{ TConnectionParameters }
|
||||||
@ -965,7 +970,7 @@ begin
|
|||||||
if DbObjectsCached(db) then
|
if DbObjectsCached(db) then
|
||||||
Result := FDBObjectLists.Objects[FDBObjectLists.IndexOf(db)] as TDBObjectList
|
Result := FDBObjectLists.Objects[FDBObjectLists.IndexOf(db)] as TDBObjectList
|
||||||
else begin
|
else begin
|
||||||
Result := TDBObjectList.Create;
|
Result := TDBObjectList.Create(TDBObjectComparer.Create);
|
||||||
Results := nil;
|
Results := nil;
|
||||||
rx := TRegExpr.Create;
|
rx := TRegExpr.Create;
|
||||||
rx.ModifierI := True;
|
rx.ModifierI := True;
|
||||||
@ -1127,6 +1132,9 @@ begin
|
|||||||
FreeAndNil(Results);
|
FreeAndNil(Results);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// Sort list like it get sorted in MainForm.vstCompareNodes
|
||||||
|
Result.Sort;
|
||||||
|
|
||||||
// Add list of objects in this database to cached list of all databases
|
// Add list of objects in this database to cached list of all databases
|
||||||
if not Assigned(FDBObjectLists) then
|
if not Assigned(FDBObjectLists) then
|
||||||
FDBObjectLists := TStringList.Create;
|
FDBObjectLists := TStringList.Create;
|
||||||
@ -1365,4 +1373,13 @@ end;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{ TDBObjectComparer }
|
||||||
|
|
||||||
|
function TDBObjectComparer.Compare(const Left, Right: TDBObject): Integer;
|
||||||
|
begin
|
||||||
|
// Simple sort method for a TDBObjectList
|
||||||
|
Result := CompareText(Left.Name, Right.Name);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
Reference in New Issue
Block a user