--- oup/current/DataAccess/Access_OUP_ADB.pas 2007/03/28 17:53:54 134 +++ oup/current/DataAccess/Access_OUP_ADB.pas 2007/04/01 22:49:17 156 @@ -46,7 +46,7 @@ type implementation uses - SysUtils, Data, Functions, ABSDecUtil, DB, DatLinks; + SysUtils, Data, Functions, ABSDecUtil, DB, DatLinks, StrUtils; (* @@ -73,6 +73,7 @@ begin FDatabase.Open; FQuery := TABSQuery.Create(FDatabase); FQuery.DisableControls; + FQuery.RequestLive := False; FQuery.DatabaseName := 'OLDBcon' + IntToStr(ConnectionID); FQuery.SQL.Text := 'SELECT [name],[value] FROM globals ORDER BY [name] ASC'; FQuery.Open; @@ -212,6 +213,39 @@ end; + function CompareItems(List: TStringList; I1, I2: Integer): Integer; + var + fin: Boolean; + pos: Integer; + s1, s2: String; + begin + fin := False; + s1 := MidStr(List[I1], 1, PosEx(';', List[I1], 6) - 1); + s2 := MidStr(List[I2], 1, PosEx(';', List[I2], 6) - 1); + pos := 1; + Result := 0; + repeat + if Ord(s1[pos]) < Ord(s2[pos]) then + begin + Result := -1; + fin := True; + end + else if Ord(s1[pos]) > Ord(s2[pos]) then + begin + Result := 1; + fin := True; + end; + Inc(pos); + until fin or (pos > Length(s1)) or (pos > Length(s2)); + + if not fin then + begin + if pos > Length(s1) then + Result := -1 + else + Result := 1; + end; + end; function TAccess_OUP_ADB.GetFilesList(ext: String; pattern: String; NoEmptyFiles: Boolean; SortType: TSortType): TStrings; @@ -252,7 +286,10 @@ var begin list := TStringList.Create; - list.Sorted := True; + if SortType in [ST_ExtNameAsc, ST_ExtNameDesc] then + list.Sorted := False + else + list.Sorted := True; for i := 0 to GetFileCount - 1 do begin if ((Length(ext) = 0) or (Pos(Fdat_files[i].Extension, ext) > 0)) and @@ -269,11 +306,13 @@ begin ST_IDAsc, ST_IDDesc: list.Add(id + ';' + name + ';' + extension); ST_NameAsc, ST_NameDesc: list.Add(name + ';' + id + ';' + extension); ST_ExtAsc, ST_ExtDesc: list.Add(extension + ';' + id + ';' + name); - ST_ExtNameAsc, ST_ExtNameDesc: list.Add(name + ';' + extension + ';' + id); + ST_ExtNameAsc, ST_ExtNameDesc: list.Add(extension + ';' + name + ';' + id); end; end; end; end; + if SortType in [ST_ExtNameAsc, ST_ExtNameDesc] then + list.CustomSort(CompareItems); if not Assigned(Result) then Result := TStringList.Create; if list.Count > 0 then