Changeset 361
- Timestamp:
- May 8, 2012, 10:24:35 PM (13 years ago)
- Location:
- PersistentData
- Files:
-
- 10 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
PersistentData/Backend/UPDClientINI.pas
r345 r361 13 13 14 14 TPDClientINI = class(TPDClient) 15 public 15 16 IniFile: TIniFile; 16 17 //procedure GetItemList(Condition: TCondition; ItemList: TItemList); override; 17 18 //procedure SetItemList(Condition: TCondition; ItemList: TItemList); override; 18 19 FileName: string; 19 constructor Create ; override;20 constructor Create(AOwner: TComponent); override; 20 21 destructor Destroy; override; 21 22 procedure Connect; override; … … 39 40 end;*) 40 41 41 constructor TPDClientINI.Create ;42 constructor TPDClientINI.Create(AOwner: TComponent); 42 43 begin 43 inherited Create; 44 inherited; 45 BackendName := 'INI'; 44 46 end; 45 47 -
PersistentData/Backend/UPDClientMySQL.pas
r345 r361 14 14 TPDClientMySQL = class(TPDClient) 15 15 protected 16 FHost: string; 17 FPort: Word; 18 FUser: string; 19 FPassword: string; 20 FDatabase: TSqlDatabase; 16 21 procedure InitSystemTypes; override; 17 22 function GetConnected: Boolean; override; 18 23 procedure Init; override; 19 24 public 20 Database: TSqlDatabase;21 25 procedure ObjectLoad(AObject: TObjectProxy); override; 22 26 procedure ObjectSave(AObject: TObjectProxy); override; … … 29 33 procedure Install; 30 34 procedure Uninstall; 31 constructor Create ; override;35 constructor Create(AOwner: TComponent); override; 32 36 destructor Destroy; override; 33 37 procedure Connect; override; 34 38 procedure Disconnect; override; 39 published 40 property Database: TSqlDatabase read FDatabase write FDatabase; 41 property Host: string read FHost write FHost; 42 property Port: Word read FPort write FPort; 43 property User: string read FUser write FUser; 44 property Password: string read FPassword write FPassword; 35 45 end; 36 46 … … 236 246 end; 237 247 238 constructor TPDClientMySQL.Create ;248 constructor TPDClientMySQL.Create(AOwner: TComponent); 239 249 begin 240 250 inherited; 241 Database := TSqlDatabase.Create(nil); 251 FDatabase := TSqlDatabase.Create(nil); 252 BackendName := 'MySQL'; 242 253 end; 243 254 244 255 destructor TPDClientMySQL.Destroy; 245 256 begin 246 FreeAndNil( Database);257 FreeAndNil(FDatabase); 247 258 inherited Destroy; 248 259 end; … … 250 261 procedure TPDClientMySQL.Connect; 251 262 begin 252 Database.Port := Port; 253 Database.UserName := User; 254 Database.Password := Password; 255 Database.HostName := Host; 256 Database.Database := Schema; 257 Database.Connect; 258 Init; 263 if not Connected then begin 264 Database.Port := Port; 265 Database.UserName := User; 266 Database.Password := Password; 267 Database.HostName := Host; 268 Database.Database := Schema; 269 Database.Connect; 270 Init; 271 end; 259 272 end; 260 273 261 274 procedure TPDClientMySQL.Disconnect; 262 275 begin 263 Database.Disconnect;276 if Connected then Database.Disconnect; 264 277 end; 265 278 -
PersistentData/Backend/UPDClientRegistry.pas
r345 r361 16 16 //procedure GetItemList(Condition: TCondition; ItemList: TItemList); override; 17 17 //procedure SetItemList(Condition: TCondition; ItemList: TItemList); override; 18 constructor Create ; override;18 constructor Create(AOwner: TComponent); override; 19 19 destructor Destroy; override; 20 20 end; … … 36 36 end;*) 37 37 38 constructor TPDClientRegistry.Create ;38 constructor TPDClientRegistry.Create(AOwner: TComponent); 39 39 begin 40 inherited; 40 41 Reg := TRegistry.Create; 41 inherited Create;42 BackendName := 'Windows registry'; 42 43 end; 43 44 -
PersistentData/Backend/UPDClientXMLRPC.pas
r340 r361 13 13 14 14 TPDClientXMLRPC = class(TPDClient) 15 constructor Create(AOwner: TComponent); override; 15 16 end; 16 17 … … 18 19 19 20 21 { TPDClientXMLRPC } 22 23 constructor TPDClientXMLRPC.Create(AOwner: TComponent); 24 begin 25 inherited Create(AOwner); 26 BackendName := 'XMLRPC'; 27 end; 28 20 29 end. 21 30 -
PersistentData/PersistentData.lpk
r340 r361 10 10 <SearchPaths> 11 11 <OtherUnitFiles Value="Backend"/> 12 <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS) \"/>12 <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> 13 13 </SearchPaths> 14 14 <CodeGeneration> … … 30 30 <License Value="GNU/GPL"/> 31 31 <Version Minor="1"/> 32 <Files Count=" 6">32 <Files Count="8"> 33 33 <Item1> 34 34 <Filename Value="UPDServer.pas"/> 35 <UnitName Value="U ChronisServer"/>35 <UnitName Value="UPDServer"/> 36 36 </Item1> 37 37 <Item2> 38 38 <Filename Value="UPDClient.pas"/> 39 <UnitName Value="U ChronisClient"/>39 <UnitName Value="UPDClient"/> 40 40 </Item2> 41 41 <Item3> 42 42 <Filename Value="Backend\UPDClientXMLRPC.pas"/> 43 <UnitName Value="U ChronisClientXMLRPC"/>43 <UnitName Value="UPDClientXMLRPC"/> 44 44 </Item3> 45 45 <Item4> 46 46 <Filename Value="Backend\UPDClientINI.pas"/> 47 <UnitName Value="U ChronisClientDirect"/>47 <UnitName Value="UPDClientINI"/> 48 48 </Item4> 49 49 <Item5> 50 50 <Filename Value="Backend\UPDClientMySQL.pas"/> 51 <UnitName Value="U ChronisClientMySQL"/>51 <UnitName Value="UPDClientMySQL"/> 52 52 </Item5> 53 53 <Item6> 54 54 <Filename Value="Backend\UPDClientRegistry.pas"/> 55 <UnitName Value="U ChronisClientDirect"/>55 <UnitName Value="UPDClientRegistry"/> 56 56 </Item6> 57 <Item7> 58 <Filename Value="UPersistentData.pas"/> 59 <HasRegisterProc Value="True"/> 60 <UnitName Value="UPersistentData"/> 61 </Item7> 62 <Item8> 63 <Filename Value="Backend\UPDClientMemory.pas"/> 64 <UnitName Value="UPDClientMemory"/> 65 </Item8> 57 66 </Files> 58 67 <Type Value="RunAndDesignTime"/> -
PersistentData/PersistentData.pas
r340 r361 9 9 uses 10 10 UPDServer, UPDClient, UPDClientXMLRPC, UPDClientINI, UPDClientMySQL, 11 UPDClientRegistry, LazarusPackageIntf;11 UPDClientRegistry, UPersistentData, UPDClientMemory, LazarusPackageIntf; 12 12 13 13 implementation … … 15 15 procedure Register; 16 16 begin 17 RegisterUnit('UPersistentData', @UPersistentData.Register); 17 18 end; 18 19 -
PersistentData/UPDClient.pas
r345 r361 80 80 { TPDClient } 81 81 82 TPDClient = class 82 TPDClient = class(TComponent) 83 83 private 84 FSchema: string; 85 procedure SetConnected(AValue: Boolean); 84 86 protected 85 87 procedure InitSystemTypes; virtual; 86 88 procedure Init; virtual; 87 89 function GetConnected: Boolean; virtual; 90 function GetConnectionString: string; virtual; 91 procedure SetConnectionString(AValue: string); virtual; 88 92 public 89 Host: string;90 Port: Word;91 Schema: string;92 User: string;93 Password: string;94 93 Types: TPDTypeList; 95 94 Version: string; 95 BackendName: string; 96 96 procedure ObjectLoad(AObject: TObjectProxy); virtual; abstract; 97 97 procedure ObjectSave(AObject: TObjectProxy); virtual; abstract; … … 104 104 procedure CheckTypes; 105 105 function TypeExists(Name: string): Boolean; virtual; abstract; 106 constructor Create ; virtual;106 constructor Create(AOwner: TComponent); override; 107 107 destructor Destroy; override; 108 108 procedure Connect; virtual; … … 111 111 procedure Uninstall; virtual; 112 112 procedure Update; virtual; 113 property Connected: Boolean read GetConnected; 114 end; 113 published 114 property Schema: string read FSchema write FSchema; 115 property Connected: Boolean read GetConnected write SetConnected; 116 property ConnectionString: string read GetConnectionString 117 write SetConnectionString; 118 end; 119 120 TPDClientClass = class of TPDClient; 115 121 116 122 implementation … … 238 244 239 245 { TPDClient } 246 247 function TPDClient.GetConnectionString: string; 248 begin 249 Result := ''; 250 end; 251 252 procedure TPDClient.SetConnectionString(AValue: string); 253 begin 254 255 end; 256 257 procedure TPDClient.SetConnected(AValue: Boolean); 258 begin 259 if AValue then Connect else Disconnect; 260 end; 240 261 241 262 procedure TPDClient.InitSystemTypes; … … 330 351 end; 331 352 332 constructor TPDClient.Create; 333 begin 353 constructor TPDClient.Create(AOwner: TComponent); 354 begin 355 inherited; 334 356 Types := TPDTypeList.Create; 335 357 Types.Client := Self; … … 345 367 procedure TPDClient.Connect; 346 368 begin 347 raise Exception.Create(SNotSupported);348 369 end; 349 370 350 371 procedure TPDClient.Disconnect; 351 372 begin 352 raise Exception.Create(SNotSupported);353 373 end; 354 374
Note:
See TracChangeset
for help on using the changeset viewer.