Changeset 45 for trunk/USystem.pas


Ignore:
Timestamp:
Mar 12, 2012, 10:23:40 AM (12 years ago)
Author:
chronos
Message:
  • Modified: TChronisBase.Active property control Client connection instead of direct call of Client.Connect and Client.Disconnect methods.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/USystem.pas

    r44 r45  
    107107
    108108  TChronisBase = class
     109  private
     110    FActive: Boolean;
     111    procedure SetActive(AValue: Boolean);
     112  public
    109113    Types: TChronisTypeList;
    110114    Client: TChronisClient;
    111     //Database: TSqlDatabase;
    112115    Modules: TListObject; // TListObject<TChronisModule>
    113116    ModuleSystem: TChronisModule;
     
    143146    constructor Create;
    144147    destructor Destroy; override;
     148    property Active: Boolean read FActive write SetActive;
    145149  private
    146150  end;
     
    266270end;
    267271
     272procedure TChronisBase.SetActive(AValue: Boolean);
     273begin
     274  if FActive = AValue then Exit;
     275  FActive := AValue;
     276  if AValue then begin
     277    Client.Connect;
     278    if Client.Connected then begin
     279      if IsDatabaseEmpty then ModuleSystem.Install;
     280      LoadTypes;
     281    end else FActive := False;
     282  end else begin
     283    Client.Disconnect;
     284    FreeAndNil(Client);
     285    Types.Clear;
     286  end;
     287end;
     288
    268289procedure TChronisBase.RegisterModule(ModuleClass: TChronisModuleClass);
    269290begin
     
    664685    Proxy.SchemaName := 'information_schema';
    665686    Proxy.ObjectName := 'tables';
    666     Proxy.Condition := 'table_name = "Information" AND table_schema = "' +
     687    Proxy.Condition := 'table_name = "SystemModule" AND table_schema = "' +
    667688      Client.Schema + '"';
    668689    Proxy.Load;
Note: See TracChangeset for help on using the changeset viewer.