Ignore:
Timestamp:
May 8, 2012, 10:24:35 PM (13 years ago)
Author:
chronos
Message:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • PersistentData/Backend/UPDClientMySQL.pas

    r345 r361  
    1414  TPDClientMySQL = class(TPDClient)
    1515  protected
     16    FHost: string;
     17    FPort: Word;
     18    FUser: string;
     19    FPassword: string;
     20    FDatabase: TSqlDatabase;
    1621    procedure InitSystemTypes; override;
    1722    function GetConnected: Boolean; override;
    1823    procedure Init; override;
    1924  public
    20     Database: TSqlDatabase;
    2125    procedure ObjectLoad(AObject: TObjectProxy); override;
    2226    procedure ObjectSave(AObject: TObjectProxy); override;
     
    2933    procedure Install;
    3034    procedure Uninstall;
    31     constructor Create; override;
     35    constructor Create(AOwner: TComponent); override;
    3236    destructor Destroy; override;
    3337    procedure Connect; override;
    3438    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;
    3545  end;
    3646
     
    236246end;
    237247
    238 constructor TPDClientMySQL.Create;
     248constructor TPDClientMySQL.Create(AOwner: TComponent);
    239249begin
    240250  inherited;
    241   Database := TSqlDatabase.Create(nil);
     251  FDatabase := TSqlDatabase.Create(nil);
     252  BackendName := 'MySQL';
    242253end;
    243254
    244255destructor TPDClientMySQL.Destroy;
    245256begin
    246   FreeAndNil(Database);
     257  FreeAndNil(FDatabase);
    247258  inherited Destroy;
    248259end;
     
    250261procedure TPDClientMySQL.Connect;
    251262begin
    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;
    259272end;
    260273
    261274procedure TPDClientMySQL.Disconnect;
    262275begin
    263   Database.Disconnect;
     276  if Connected then Database.Disconnect;
    264277end;
    265278
Note: See TracChangeset for help on using the changeset viewer.