Changeset 138 for trunk/Packages/PersistentData
- Timestamp:
- Sep 9, 2022, 8:20:25 PM (2 years ago)
- Location:
- trunk/Packages/PersistentData
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/PersistentData/Backend/UPDClientMemory.pas
r137 r138 4 4 5 5 uses 6 Classes, SysUtils, UPDClient, SpecializedList;6 Classes, SysUtils, UPDClient, Generics.Collections; 7 7 8 8 type … … 19 19 function SearchObject(Id: Integer): TObjectProxy; 20 20 public 21 Objects: T ListObject;21 Objects: TObjectList<TObjectProxy>; 22 22 procedure ObjectLoad(AObject: TObjectProxy); override; 23 23 procedure ObjectSave(AObject: TObjectProxy); override; … … 96 96 else begin 97 97 AObject.Id := GetNewObjectId; 98 Obj := TObjectProxy(Objects.Add New(TObjectProxy.Create));98 Obj := TObjectProxy(Objects.Add(TObjectProxy.Create)); 99 99 Obj.Assign(AObject); 100 100 end; … … 118 118 NewObject: TObjectProxy; 119 119 Table: string; 120 Item: TPair<string, string>; 120 121 begin 121 122 AList.Objects.Clear; … … 131 132 132 133 if AList.ColummsFilterUse then begin 133 for P := 0 to Properties.Count - 1do134 if AList.ColumnsFilter.IndexOf( Properties.Keys[I]) <> -1 then135 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); 136 137 end else NewObject.Properties.Assign(Properties); 137 138 end; … … 172 173 begin 173 174 inherited; 174 Objects := T ListObject.Create;175 Objects := TObjectList<TObjectProxy>.Create; 175 176 BackendName := 'Memory'; 176 177 end; -
trunk/Packages/PersistentData/Backend/UPDClientMySQL.pas
r137 r138 4 4 5 5 uses 6 Classes, SysUtils, USqlDatabase, UPDClient, SpecializedDictionary;6 Classes, SysUtils, USqlDatabase, UPDClient, UGenerics; 7 7 8 8 type -
trunk/Packages/PersistentData/PersistentData.lpk
r87 r138 1 <?xml version="1.0" ?>1 <?xml version="1.0" encoding="UTF-8"?> 2 2 <CONFIG> 3 <Package Version=" 4">3 <Package Version="5"> 4 4 <PathDelim Value="\"/> 5 5 <Name Value="PersistentData"/> 6 <Type Value="RunAndDesignTime"/> 6 7 <Author Value="Chronos"/> 7 8 <CompilerOptions> … … 12 13 <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> 13 14 </SearchPaths> 15 <Parsing> 16 <SyntaxOptions> 17 <SyntaxMode Value="Delphi"/> 18 <CStyleOperator Value="False"/> 19 <AllowLabel Value="False"/> 20 <CPPInline Value="False"/> 21 </SyntaxOptions> 22 </Parsing> 14 23 <CodeGeneration> 15 24 <Checks> … … 20 29 </Checks> 21 30 </CodeGeneration> 22 <Other>23 <CompilerMessages>24 <MsgFileName Value=""/>25 </CompilerMessages>26 <CompilerPath Value="$(CompPath)"/>27 </Other>28 31 </CompilerOptions> 29 32 <Description Value="Generic data persistence layer"/> … … 65 68 </Item8> 66 69 </Files> 67 < Type Value="RunAndDesignTime"/>70 <CompatibilityMode Value="True"/> 68 71 <RequiredPkgs Count="2"> 69 72 <Item1> -
trunk/Packages/PersistentData/UPDClient.pas
r137 r138 4 4 5 5 uses 6 Classes, SysUtils, SpecializedList, SpecializedDictionary;6 Classes, SysUtils, Generics.Collections, UGenerics; 7 7 8 8 const … … 57 57 ObjectName: string; 58 58 Path: string; 59 Objects: T ListObject; // TListObject<TObjectProxy>59 Objects: TObjectList<TObjectProxy>; 60 60 procedure Clear; 61 61 constructor Create; … … 74 74 { TPDTypePropertyList } 75 75 76 TPDTypePropertyList = class(T ListObject)76 TPDTypePropertyList = class(TObjectList<TPDTypeProperty>) 77 77 Client: TPDClient; 78 78 procedure AddSimple(Name: string; TypeName: string; Unique: Boolean = False; … … 100 100 { TPDTypeList } 101 101 102 TPDTypeList = class(T ListObject)102 TPDTypeList = class(TObjectList<TPDType>) 103 103 Client: TPDClient; 104 104 function AddType(Name: string; DbType: string = ''): TPDType; … … 147 147 TPDClientClass = class of TPDClient; 148 148 149 150 151 152 153 149 resourcestring 150 SClientNotSet = 'Client not set'; 151 SNotSupported = 'Not supported'; 152 SVersionMismatch = 'Version mismatch, client: %0:s, server: %1:s. Please upgrade database.'; 153 SCantLoadObjectWithoutId = 'Can''t load object without id'; 154 154 155 155 … … 163 163 NewProperty: TPDTypeProperty; 164 164 begin 165 NewProperty := TPDTypeProperty(Add New(TPDTypeProperty.Create));165 NewProperty := TPDTypeProperty(Add(TPDTypeProperty.Create)); 166 166 NewProperty.Name := Name; 167 167 NewProperty.DbType := Client.Types.SearchByName(TypeName); … … 175 175 function TPDTypeList.AddType(Name: string; DbType: string = ''): TPDType; 176 176 begin 177 Result := TPDType(Add New(TPDType.Create));177 Result := TPDType(Add(TPDType.Create)); 178 178 Result.Client := Client; 179 179 Result.Name := Name; … … 280 280 begin 281 281 ColumnsFilter := TListString.Create; 282 Objects := T ListObject.Create;282 Objects := TObjectList<TObjectProxy>.Create; 283 283 end; 284 284 … … 345 345 NewObject.Load; 346 346 347 DbVersion := NewObject.Properties. Values['Version'];347 DbVersion := NewObject.Properties.Items['Version']; 348 348 if Version <> DbVersion then 349 349 raise Exception.Create(Format(SVersionMismatch, [Version, DbVersion])); … … 395 395 Tables.Count := NewProxy.Objects.Count; 396 396 for I := 0 to NewProxy.Objects.Count - 1 do 397 Tables[I] := TObjectProxy(NewProxy.Objects[I]).Properties. Values['TABLE_NAME'];397 Tables[I] := TObjectProxy(NewProxy.Objects[I]).Properties.Items['TABLE_NAME']; 398 398 399 399 for I := 0 to Types.Count - 1 do -
trunk/Packages/PersistentData/UPersistentData.pas
r137 r138 4 4 5 5 uses 6 Classes, SysUtils, UPDClient, SpecializedList;6 Classes, SysUtils, UPDClient, Generics.Collections; 7 7 8 8 type … … 16 16 TPDManager = class(TComponent) 17 17 public 18 Items: T ListObject;18 Items: TObjectList<TPDManagerItem>; 19 19 procedure Register(ClientClass: TPDClientClass); 20 20 procedure LoadToStrings(Strings: TStrings); … … 76 76 begin 77 77 inherited; 78 Items := T ListObject.Create;78 Items := TObjectList<TPDManagerItem>.Create; 79 79 end; 80 80
Note:
See TracChangeset
for help on using the changeset viewer.