Changeset 561 for PersistentData/Backend


Ignore:
Timestamp:
Sep 10, 2022, 6:26:39 PM (2 years ago)
Author:
chronos
Message:
  • Modified: Code cleanup.
  • Modified: Use Generics.Collections.
Location:
PersistentData/Backend
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • PersistentData/Backend/UPDClientINI.pas

    r361 r561  
    11unit UPDClientINI;
    2 
    3 {$mode delphi}
    42
    53interface
     
    2321    procedure Disconnect; override;
    2422  end;
     23
    2524
    2625implementation
     
    4948begin
    5049  Disconnect;
    51   inherited Destroy;
     50  inherited;
    5251end;
    5352
  • PersistentData/Backend/UPDClientMemory.pas

    r387 r561  
    11unit UPDClientMemory;
    2 
    3 {$mode Delphi}{$H+}
    42
    53interface
    64
    75uses
    8   Classes, SysUtils, UPDClient, SpecializedList;
     6  Classes, SysUtils, UPDClient, Generics.Collections;
    97
    108type
     
    2119    function SearchObject(Id: Integer): TObjectProxy;
    2220  public
    23     Objects: TListObject;
     21    Objects: TObjectProxies;
    2422    procedure ObjectLoad(AObject: TObjectProxy); override;
    2523    procedure ObjectSave(AObject: TObjectProxy); override;
     
    4038resourcestring
    4139  SObjectNotFound = 'Object with id %s not found';
     40
    4241
    4342implementation
     
    9796    else begin
    9897      AObject.Id := GetNewObjectId;
    99       Obj := TObjectProxy(Objects.AddNew(TObjectProxy.Create));
     98      Obj := Objects.AddProxy;
    10099      Obj.Assign(AObject);
    101100    end;
     
    119118  NewObject: TObjectProxy;
    120119  Table: string;
     120  Item: TPair<string, string>;
    121121begin
    122122  AList.Objects.Clear;
     
    132132
    133133      if AList.ColummsFilterUse then begin
    134         for P := 0 to Properties.Count - 1 do
    135         if AList.ColumnsFilter.IndexOf(Properties.Keys[I]) <> -1 then
    136           NewObject.Properties.Add(Properties.Keys[I], Properties[I].Value);
     134        for Item in Properties do
     135        if AList.ColumnsFilter.IndexOf(Item.Key) <> -1 then
     136          NewObject.Properties.Add(Item.Key, Item.Value);
    137137      end else NewObject.Properties.Assign(Properties);
    138138    end;
     
    147147procedure TPDClientMemory.ListSave(AList: TListProxy);
    148148begin
    149 
    150149end;
    151150
    152151procedure TPDClientMemory.TypeDefine(AType: TPDType);
    153152begin
    154 
    155153end;
    156154
    157155procedure TPDClientMemory.TypeUndefine(AType: TPDType);
    158156begin
    159 
    160157end;
    161158
    162159function TPDClientMemory.TypeIsDefined(AType: TPDType): Boolean;
    163160begin
    164 
     161  Result := False;
    165162end;
    166163
    167164procedure TPDClientMemory.Install;
    168165begin
    169 
    170166end;
    171167
    172168procedure TPDClientMemory.Uninstall;
    173169begin
    174 
    175170end;
    176171
     
    178173begin
    179174  inherited;
    180   Objects := TListObject.Create;
     175  Objects := TObjectProxies.Create;
    181176  BackendName := 'Memory';
    182177end;
     
    184179destructor TPDClientMemory.Destroy;
    185180begin
    186   Objects.Free;
    187   inherited Destroy;
     181  FreeAndNil(Objects);
     182  inherited;
    188183end;
    189184
    190185procedure TPDClientMemory.Connect;
    191186begin
    192   inherited Connect;
     187  inherited;
    193188end;
    194189
    195190procedure TPDClientMemory.Disconnect;
    196191begin
    197   inherited Disconnect;
     192  inherited;
    198193end;
    199194
  • PersistentData/Backend/UPDClientMySQL.pas

    r362 r561  
    11unit UPDClientMySQL;
    22
    3 {$mode delphi}
    4 
    53interface
    64
    75uses
    8   Classes, SysUtils, USqlDatabase, UPDClient, SpecializedDictionary;
     6  Classes, SysUtils, USqlDatabase, UPDClient, UGenerics;
    97
    108type
     
    2220    function GetConnected: Boolean; override;
    2321    procedure Init; override;
     22    function GetConnectionString: string; override;
    2423  public
    2524    procedure ObjectLoad(AObject: TObjectProxy); override;
     
    4544  end;
    4645
     46
    4747implementation
    48 
    4948
    5049resourcestring
    5150  SMissingBaseType = 'Missing base typ for %s';
    5251  SUndefinedType = 'Undefined type in %0:s.%1:s';
    53 
    5452
    5553{ TPDClientMySQL }
     
    155153procedure TPDClientMySQL.ListSave(AList: TListProxy);
    156154begin
    157 
    158155end;
    159156
     
    245242end;
    246243
     244function TPDClientMySQL.GetConnectionString: string;
     245begin
     246  Result := 'Host:' + Host + ',Port:' + IntToStr(Port) + ',User:' + User +
     247    ',Password:' + Password + ',Schema:' + Schema;
     248end;
     249
    247250constructor TPDClientMySQL.Create(AOwner: TComponent);
    248251begin
     
    255258begin
    256259  FreeAndNil(FDatabase);
    257   inherited Destroy;
     260  inherited;
    258261end;
    259262
  • PersistentData/Backend/UPDClientRegistry.pas

    r361 r561  
    11unit UPDClientRegistry;
    2 
    3 {$mode delphi}
    42
    53interface
     
    1311
    1412  TPDClientRegistry = class(TPDClient)
     13  public
    1514    Reg: TRegistry;
    1615    //procedure GetItemList(Condition: TCondition; ItemList: TItemList); override;
     
    1918    destructor Destroy; override;
    2019  end;
     20
    2121
    2222implementation
     
    4646begin
    4747  Reg.Free;
    48   inherited Destroy;
     48  inherited;
    4949end;
    5050
  • PersistentData/Backend/UPDClientXMLRPC.pas

    r361 r561  
    11unit UPDClientXMLRPC;
    2 
    3 {$mode delphi}
    42
    53interface
     
    1614  end;
    1715
     16
    1817implementation
    19 
    2018
    2119{ TPDClientXMLRPC }
Note: See TracChangeset for help on using the changeset viewer.