Changeset 142 for trunk/Packages/PersistentData
- Timestamp:
- Sep 10, 2022, 6:24:58 PM (2 years ago)
- Location:
- trunk/Packages/PersistentData
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/PersistentData/Backend/UPDClientMemory.pas
r138 r142 19 19 function SearchObject(Id: Integer): TObjectProxy; 20 20 public 21 Objects: TObject List<TObjectProxy>;21 Objects: TObjectProxies; 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(TObjectProxy.Create));98 Obj := Objects.AddProxy; 99 99 Obj.Assign(AObject); 100 100 end; … … 173 173 begin 174 174 inherited; 175 Objects := TObject List<TObjectProxy>.Create;175 Objects := TObjectProxies.Create; 176 176 BackendName := 'Memory'; 177 177 end; … … 179 179 destructor TPDClientMemory.Destroy; 180 180 begin 181 Objects.Free;181 FreeAndNil(Objects); 182 182 inherited; 183 183 end; … … 185 185 procedure TPDClientMemory.Connect; 186 186 begin 187 inherited Connect;187 inherited; 188 188 end; 189 189 190 190 procedure TPDClientMemory.Disconnect; 191 191 begin 192 inherited Disconnect;192 inherited; 193 193 end; 194 194 -
trunk/Packages/PersistentData/Backend/UPDClientMySQL.pas
r138 r142 153 153 procedure TPDClientMySQL.ListSave(AList: TListProxy); 154 154 begin 155 156 155 end; 157 156 -
trunk/Packages/PersistentData/PersistentData.lpk
r138 r142 11 11 <SearchPaths> 12 12 <OtherUnitFiles Value="Backend"/> 13 <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS) "/>13 <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)-$(BuildMode)"/> 14 14 </SearchPaths> 15 15 <Parsing> … … 21 21 </SyntaxOptions> 22 22 </Parsing> 23 <CodeGeneration> 24 <Checks> 25 <IOChecks Value="True"/> 26 <RangeChecks Value="True"/> 27 <OverflowChecks Value="True"/> 28 <StackChecks Value="True"/> 29 </Checks> 30 </CodeGeneration> 23 <Linking> 24 <Debugging> 25 <GenerateDebugInfo Value="False"/> 26 </Debugging> 27 </Linking> 31 28 </CompilerOptions> 32 29 <Description Value="Generic data persistence layer"/> 33 30 <License Value="GNU/GPL"/> 34 <Version Minor=" 1"/>31 <Version Minor="2"/> 35 32 <Files Count="8"> 36 33 <Item1> … … 69 66 </Files> 70 67 <CompatibilityMode Value="True"/> 68 <i18n> 69 <EnableI18N Value="True"/> 70 </i18n> 71 71 <RequiredPkgs Count="2"> 72 72 <Item1> -
trunk/Packages/PersistentData/UPDClient.pas
r138 r142 31 31 destructor Destroy; override; 32 32 procedure Assign(Source: TObjectProxy); 33 end; 34 35 { TObjectProxies } 36 37 TObjectProxies = class(TObjectList<TObjectProxy>) 38 function AddProxy: TObjectProxy; 33 39 end; 34 40 … … 72 78 end; 73 79 74 { TPDTypePropert yList}75 76 TPDTypePropert yList= class(TObjectList<TPDTypeProperty>)80 { TPDTypeProperties } 81 82 TPDTypeProperties = class(TObjectList<TPDTypeProperty>) 77 83 Client: TPDClient; 78 procedureAddSimple(Name: string; TypeName: string; Unique: Boolean = False;79 Index: Boolean = False) ;84 function AddSimple(Name: string; TypeName: string; Unique: Boolean = False; 85 Index: Boolean = False): TPDTypeProperty; 80 86 end; 81 87 … … 89 95 Name: string; 90 96 DbType: string; 91 Properties: TPDTypePropert yList;97 Properties: TPDTypeProperties; 92 98 function IsDefined: Boolean; 93 99 procedure Define; … … 98 104 end; 99 105 100 { TPDType List}101 102 TPDType List= class(TObjectList<TPDType>)106 { TPDTypes } 107 108 TPDTypes = class(TObjectList<TPDType>) 103 109 Client: TPDClient; 104 110 function AddType(Name: string; DbType: string = ''): TPDType; … … 119 125 procedure SetConnectionString(AValue: string); virtual; 120 126 public 121 Types: TPDType List;127 Types: TPDTypes; 122 128 Version: string; 123 129 BackendName: string; … … 156 162 implementation 157 163 158 { TPDTypePropertyList } 159 160 procedure TPDTypePropertyList.AddSimple(Name: string; TypeName: string; 161 Unique: Boolean = False; Index: Boolean = False); 162 var 163 NewProperty: TPDTypeProperty; 164 begin 165 NewProperty := TPDTypeProperty(Add(TPDTypeProperty.Create)); 166 NewProperty.Name := Name; 167 NewProperty.DbType := Client.Types.SearchByName(TypeName); 168 NewProperty.Unique := Unique; 169 NewProperty.Index := Index; 170 end; 171 172 173 { TPDTypeList } 174 175 function TPDTypeList.AddType(Name: string; DbType: string = ''): TPDType; 176 begin 177 Result := TPDType(Add(TPDType.Create)); 164 { TObjectProxies } 165 166 function TObjectProxies.AddProxy: TObjectProxy; 167 begin 168 Result := TObjectProxy.Create; 169 Add(Result); 170 end; 171 172 { TPDTypeProperties } 173 174 function TPDTypeProperties.AddSimple(Name: string; TypeName: string; 175 Unique: Boolean = False; Index: Boolean = False): TPDTypeProperty; 176 begin 177 Result := TPDTypeProperty.Create; 178 Result.Name := Name; 179 Result.DbType := Client.Types.SearchByName(TypeName); 180 Result.Unique := Unique; 181 Result.Index := Index; 182 Add(Result); 183 end; 184 185 { TPDTypes } 186 187 function TPDTypes.AddType(Name: string; DbType: string = ''): TPDType; 188 begin 189 Result := TPDType.Create; 178 190 Result.Client := Client; 179 191 Result.Name := Name; 180 192 Result.DbType := DbType; 181 end; 182 183 function TPDTypeList.SearchByName(Name: string): TPDType; 193 Add(Result); 194 end; 195 196 function TPDTypes.SearchByName(Name: string): TPDType; 184 197 var 185 198 I: Integer; … … 218 231 constructor TPDType.Create; 219 232 begin 220 Properties := TPDTypePropert yList.Create;233 Properties := TPDTypeProperties.Create; 221 234 end; 222 235 223 236 destructor TPDType.Destroy; 224 237 begin 225 Properties.Free;238 FreeAndNil(Properties); 226 239 inherited; 227 240 end; … … 254 267 destructor TObjectProxy.Destroy; 255 268 begin 256 Properties.Free;269 FreeAndNil(Properties); 257 270 inherited; 258 271 end; … … 285 298 destructor TListProxy.Destroy; 286 299 begin 287 Objects.Free;288 ColumnsFilter.Free;300 FreeAndNil(Objects); 301 FreeAndNil(ColumnsFilter); 289 302 inherited; 290 303 end; … … 311 324 procedure TPDClient.SetConnectionString(AValue: string); 312 325 begin 313 314 326 end; 315 327 … … 413 425 begin 414 426 inherited; 415 Types := TPDType List.Create;427 Types := TPDTypes.Create; 416 428 Types.Client := Self; 417 429 InitSystemTypes; … … 420 432 destructor TPDClient.Destroy; 421 433 begin 422 Types.Free;434 FreeAndNil(Types); 423 435 inherited; 424 436 end; … … 434 446 procedure TPDClient.Install; 435 447 begin 436 437 448 end; 438 449 … … 444 455 procedure TPDClient.Update; 445 456 begin 446 447 457 end; 448 458 -
trunk/Packages/PersistentData/UPersistentData.pas
r138 r142 12 12 end; 13 13 14 TPDManagerItems = class(TObjectList<TPDManagerItem>) 15 end; 16 14 17 { TPDManager } 15 18 16 19 TPDManager = class(TComponent) 17 20 public 18 Items: T ObjectList<TPDManagerItem>;21 Items: TPDManagerItems; 19 22 procedure Register(ClientClass: TPDClientClass); 20 23 procedure LoadToStrings(Strings: TStrings); … … 76 79 begin 77 80 inherited; 78 Items := T ObjectList<TPDManagerItem>.Create;81 Items := TPDManagerItems.Create; 79 82 end; 80 83
Note:
See TracChangeset
for help on using the changeset viewer.