Changeset 361 for PersistentData/Backend/UPDClientMySQL.pas
- Timestamp:
- May 8, 2012, 10:24:35 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note:
See TracChangeset
for help on using the changeset viewer.