Changeset 29 for trunk/USystem.pas
- Timestamp:
- Nov 23, 2011, 8:24:07 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/USystem.pas
r28 r29 7 7 uses 8 8 Classes, SysUtils, SpecializedList, SpecializedDictionary, USqlDatabase, 9 Strings, UDataTypes, Dialogs, ComCtrls, StdCtrls, Controls, UChronisClient; 9 Strings, UDataTypes, Dialogs, ComCtrls, StdCtrls, Controls, UChronisClient, 10 UChronisModule; 10 11 11 12 const … … 105 106 Client: TChronisClient; 106 107 Database: TSqlDatabase; 108 Modules: TListObject; // TListObject<TChronisModule> 109 ModuleSystem: TChronisModule; 110 procedure RegisterModule(ModuleClass: TChronisModuleClass); 107 111 function AddType(Name, DataType: string; TypeIndex: TDbValueType): Integer; 108 112 function AddGroup(Name: string; ParentGroupId: Integer = 0): Integer; … … 132 136 function AddModule(Name, Author, Website, Version, Description, License: string): Integer; 133 137 procedure LoadTypes; 138 function IsDatabaseEmpty: Boolean; 134 139 constructor Create; 135 140 destructor Destroy; override; … … 235 240 end; 236 241 242 procedure TChronisBase.RegisterModule(ModuleClass: TChronisModuleClass); 243 begin 244 Modules.AddNew(ModuleClass.Create); 245 TChronisModule(Modules.Last).System := TChronisBase(Self); 246 end; 247 237 248 function TChronisBase.AddType(Name, DataType: string; TypeIndex: TDbValueType): Integer; 238 249 var … … 625 636 end; 626 637 638 function TChronisBase.IsDatabaseEmpty: Boolean; 639 var 640 DbRows: TDbRows; 641 begin 642 try 643 DbRows := TDbRows.Create; 644 Database.Query(DbRows, 'SELECT 1 FROM information_schema.tables WHERE table_name = "Information" AND table_schema = "' + 645 Database.Database + '"'); 646 Result := DbRows.Count = 0; 647 finally 648 DbRows.Free; 649 end; 650 end; 651 627 652 constructor TChronisBase.Create; 628 653 begin 629 654 Types := TChronisTypeList.Create; 655 Modules := TListObject.Create; 630 656 Client := nil; 631 657 end; … … 634 660 begin 635 661 Types.Free; 662 Modules.Free; 636 663 Client.Free; 637 664 inherited Destroy;
Note:
See TracChangeset
for help on using the changeset viewer.