mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-06 18:24:26 +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
|
||||
else begin
|
||||
// Compare Strings
|
||||
Result := AnsiCompareText( CellText1, CellText2 );
|
||||
Result := CompareText( CellText1, CellText2 );
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -3,7 +3,8 @@ unit mysql_connection;
|
||||
interface
|
||||
|
||||
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
|
||||
{ TDBObjectList and friends }
|
||||
@ -19,6 +20,10 @@ type
|
||||
PDBObject = ^TDBObject;
|
||||
TDBObjectList = TObjectList<TDBObject>;
|
||||
|
||||
TDBObjectComparer = class(TComparer<TDBObject>)
|
||||
function Compare(const Left, Right: TDBObject): Integer; override;
|
||||
end;
|
||||
|
||||
{$M+} // Needed to add published properties
|
||||
|
||||
{ TConnectionParameters }
|
||||
@ -965,7 +970,7 @@ begin
|
||||
if DbObjectsCached(db) then
|
||||
Result := FDBObjectLists.Objects[FDBObjectLists.IndexOf(db)] as TDBObjectList
|
||||
else begin
|
||||
Result := TDBObjectList.Create;
|
||||
Result := TDBObjectList.Create(TDBObjectComparer.Create);
|
||||
Results := nil;
|
||||
rx := TRegExpr.Create;
|
||||
rx.ModifierI := True;
|
||||
@ -1127,6 +1132,9 @@ begin
|
||||
FreeAndNil(Results);
|
||||
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
|
||||
if not Assigned(FDBObjectLists) then
|
||||
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.
|
||||
|
Reference in New Issue
Block a user