diff --git a/source/main.pas b/source/main.pas index 4c52c438..da7ff286 100644 --- a/source/main.pas +++ b/source/main.pas @@ -5672,7 +5672,7 @@ begin end else begin // Compare Strings - Result := AnsiCompareText( CellText1, CellText2 ); + Result := CompareText( CellText1, CellText2 ); end; end; diff --git a/source/mysql_connection.pas b/source/mysql_connection.pas index cc98dc14..495fdd71 100644 --- a/source/mysql_connection.pas +++ b/source/mysql_connection.pas @@ -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; + TDBObjectComparer = class(TComparer) + 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.