Changeset 362 for PersistentData/UPDClient.pas
- Timestamp:
- May 10, 2012, 1:18:25 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
PersistentData/UPDClient.pas
r361 r362 15 15 16 16 TPDClient = class; 17 TPDType = class; 17 18 18 19 TOrderDirection = (odNone, odAscending, odDescending); … … 31 32 constructor Create; 32 33 destructor Destroy; override; 34 procedure Assign(Source: TObjectProxy); 35 end; 36 37 TOperation = (opUndefined, opDefined, opEqual, opNotEqual, 38 opLess, opMore, opLessOrEqual, opMoreOrEqual); 39 40 TCondition = class 41 Column: string; 42 Operation: TOperation; 43 Value: string; 33 44 end; 34 45 … … 56 67 end; 57 68 69 TPDTypeProperty = class 70 Name: string; 71 DbType: TPDType; 72 Unique: Boolean; 73 Index: Boolean; 74 end; 75 76 { TPDTypePropertyList } 77 78 TPDTypePropertyList = class(TListObject) 79 Client: TPDClient; 80 procedure AddSimple(Name: string; TypeName: string; Unique: Boolean = False; 81 Index: Boolean = False); 82 end; 83 58 84 { TPDType } 59 85 60 86 TPDType = class 61 Client: TPDClient; 87 private 88 FClient: TPDClient; 89 procedure SetClient(AValue: TPDClient); 90 public 62 91 Name: string; 63 92 DbType: string; 64 Properties: T DictionaryStringString;93 Properties: TPDTypePropertyList; 65 94 function IsDefined: Boolean; 66 95 procedure Define; … … 68 97 constructor Create; 69 98 destructor Destroy; override; 99 property Client: TPDClient read FClient write SetClient; 70 100 end; 71 101 … … 103 133 procedure TypeUndefine(AType: TPDType); virtual; abstract; 104 134 procedure CheckTypes; 105 function TypeExists(Name: string): Boolean; virtual; abstract;106 135 constructor Create(AOwner: TComponent); override; 107 136 destructor Destroy; override; … … 120 149 TPDClientClass = class of TPDClient; 121 150 151 resourcestring 152 SClientNotSet = 'Client not set'; 153 SNotSupported = 'Not supported'; 154 SVersionMismatch = 'Version mismatch, client: %0:s, server: %1:s. Please upgrade database.'; 155 SCantLoadObjectWithoutId = 'Can''t load object without id'; 156 157 122 158 implementation 123 159 124 resourcestring 125 SClientNotSet = 'Client not set'; 126 SNotSupported = 'Not supported'; 127 SVersionMismatch = 'Version mismatch, client: %0:s, server: %1:s. Please upgrade database.'; 160 { TPDTypePropertyList } 161 162 procedure TPDTypePropertyList.AddSimple(Name: string; TypeName: string; 163 Unique: Boolean; Index: Boolean); 164 var 165 NewProperty: TPDTypeProperty; 166 begin 167 NewProperty := TPDTypeProperty(AddNew(TPDTypeProperty.Create)); 168 NewProperty.Name := Name; 169 NewProperty.DbType := Client.Types.SearchByName(TypeName); 170 NewProperty.Unique := Unique; 171 NewProperty.Index := Index; 172 end; 128 173 129 174 … … 148 193 end; 149 194 195 procedure TPDType.SetClient(AValue: TPDClient); 196 begin 197 if FClient = AValue then Exit; 198 FClient := AValue; 199 Properties.Client := AValue; 200 end; 201 150 202 function TPDType.IsDefined: Boolean; 151 203 begin … … 168 220 constructor TPDType.Create; 169 221 begin 170 Properties := T DictionaryStringString.Create;222 Properties := TPDTypePropertyList.Create; 171 223 end; 172 224 … … 206 258 Properties.Free; 207 259 inherited Destroy; 260 end; 261 262 procedure TObjectProxy.Assign(Source: TObjectProxy); 263 begin 264 Path := Source.Path; 265 Client := Source.Client; 266 ObjectName := Source.ObjectName; 267 Id := Source.Id; 268 Properties.Assign(Source.Properties); 208 269 end; 209 270 … … 293 354 NewType.Client := Self; 294 355 NewType.Name := SystemVersionObject; 295 NewType.Properties.Add ('Version', 'String');296 NewType.Properties.Add ('Time', 'DateTime');356 NewType.Properties.AddSimple('Version', 'String'); 357 NewType.Properties.AddSimple('Time', 'DateTime'); 297 358 NewType.Define; 298 359 … … 380 441 procedure TPDClient.Uninstall; 381 442 begin 382 443 //Types.Uninstall; 383 444 end; 384 445
Note:
See TracChangeset
for help on using the changeset viewer.