Changeset 14 for trunk/Forms/UMainForm.pas
- Timestamp:
- Jun 10, 2011, 2:16:52 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UMainForm.pas
r13 r14 104 104 PersistentForm: TPersistentForm; 105 105 TreeState: TTreeState; 106 System: TChronisBase;107 106 Report: TReport; 108 107 procedure LoadTree; … … 138 137 OpenKey(RegistryKey, True); 139 138 Panel1.Width := ReadIntegerWithDefault('GroupTreeWidth', 200); 140 System.Database.Database := ReadStringWithDefault('DatabaseSchema', 'chronis');141 System.Database.Hostname := ReadStringWithDefault('DatabaseHostName', 'localhost');142 System.Database.UserName := ReadStringWithDefault('DatabaseUserName', 'chronis');143 System.Database.Password := ReadStringWithDefault('DatabasePassword', '');139 Core.System.Database.Database := ReadStringWithDefault('DatabaseSchema', 'chronis'); 140 Core.System.Database.Hostname := ReadStringWithDefault('DatabaseHostName', 'localhost'); 141 Core.System.Database.UserName := ReadStringWithDefault('DatabaseUserName', 'chronis'); 142 Core.System.Database.Password := ReadStringWithDefault('DatabasePassword', ''); 144 143 with Core.CoolTranslator1 do 145 144 Language := Languages.SearchByCode(ReadStringWithDefault('LanguageCode', '')); … … 156 155 OpenKey(RegistryKey, True); 157 156 WriteInteger('GroupTreeWidth', Panel1.Width); 158 WriteString('DatabaseSchema', System.Database.Database);159 WriteString('DatabaseHostName', System.Database.Hostname);160 WriteString('DatabaseUserName', System.Database.UserName);161 WriteString('DatabasePassword', System.Database.Password);157 WriteString('DatabaseSchema', Core.System.Database.Database); 158 WriteString('DatabaseHostName', Core.System.Database.Hostname); 159 WriteString('DatabaseUserName', Core.System.Database.UserName); 160 WriteString('DatabasePassword', Core.System.Database.Password); 162 161 with Core.CoolTranslator1 do 163 162 WriteString('LanguageCode', Language.Code); … … 177 176 I: Integer; 178 177 begin 179 with System do178 with Core.System do 180 179 try 181 180 DbRows := TDbRows.Create; … … 245 244 '`Name` varchar(255) NOT NULL,' + 246 245 '`DbType` varchar(255) NOT NULL,' + 247 '`TypeIndex` int(11) NOT NULL,' +248 246 'PRIMARY KEY (`Id`)' + 249 247 ') ENGINE=InnoDB DEFAULT CHARSET=utf8'); … … 326 324 end; 327 325 328 if Tables.IndexOf(CustomType ) = -1 then begin329 Database.Query(DbRows, 'CREATE TABLE IF NOT EXISTS `' + CustomType + '` ( ' +326 if Tables.IndexOf(CustomTypeTableName) = -1 then begin 327 Database.Query(DbRows, 'CREATE TABLE IF NOT EXISTS `' + CustomTypeTableName + '` ( ' + 330 328 '`Id` int(11) NOT NULL AUTO_INCREMENT,' + 331 329 '`Type` int NOT NULL,' + … … 373 371 EnumId: Integer; 374 372 begin 375 with System do begin373 with Core.System do begin 376 374 TypeNumber := AddType('Number', 'INT', vtInteger); 377 375 TypeString := AddType('String', 'VARCHAR(255)', vtString); … … 407 405 GroupId := AddObjectGroup('System'); 408 406 409 ObjectId := AddObject('Object groups', 'ObjectGroup', System.Database.Database, GroupId);407 ObjectId := AddObject('Object groups', 'ObjectGroup', Core.System.Database.Database, GroupId); 410 408 AddPropertyString(ObjectId, 'Name', 'Name'); 411 ObjectId := AddObject('Objects', 'Object', System.Database.Database, GroupId);409 ObjectId := AddObject('Objects', 'Object', Core.System.Database.Database, GroupId); 412 410 AddPropertyString(ObjectId, 'Name', 'Name'); 413 411 AddPropertyNumber(ObjectId, 'Group', 'Group'); … … 416 414 AddPropertyString(ObjectId, 'Primary key', 'PrimaryKey'); 417 415 AddPropertyNumber(ObjectId, 'Sequence', 'Sequence'); 418 ObjectId := AddObject('Property types', 'Type', System.Database.Database, GroupId);416 ObjectId := AddObject('Property types', 'Type', Core.System.Database.Database, GroupId); 419 417 AddPropertyString(ObjectId, 'Name', 'Name'); 420 418 AddPropertyString(ObjectId, 'Type', 'DbType'); 421 AddPropertyNumber(ObjectId, 'Type index', 'TypeIndex');422 419 AddPropertyNumber(ObjectId, 'Parent', 'Parent'); 423 ObjectId := AddObject('Property groups', 'PropertyGroup', System.Database.Database, GroupId);424 ObjectId := AddObject('Properties', 'Property', System.Database.Database, GroupId);420 ObjectId := AddObject('Property groups', 'PropertyGroup', Core.System.Database.Database, GroupId); 421 ObjectId := AddObject('Properties', 'Property', Core.System.Database.Database, GroupId); 425 422 AddPropertyString(ObjectId, 'Name', 'Name'); 426 423 AddPropertyNumber(ObjectId, 'Object', 'Object'); 427 AddPropertyNumber(ObjectId, 'Property Group', 'PropertyGroup');428 AddPropertyNumber(ObjectId, ' Type', 'Type');424 AddPropertyNumber(ObjectId, 'Property group', 'PropertyGroup'); 425 AddPropertyNumber(ObjectId, 'Custom type', 'CustomType'); 429 426 AddProperty(ObjectId, 'Editable', 'Editable', TypeBoolean); 430 AddPropertyString(ObjectId, 'Column Name', 'ColumnName');427 AddPropertyString(ObjectId, 'Column name', 'ColumnName'); 431 428 end; 432 429 end; … … 434 431 procedure TMainForm.FormCreate(Sender: TObject); 435 432 begin 436 System := TChronisBase.Create;437 System.Database := TSqlDatabase.Create;438 433 TreeState := TTreeState.Create; 439 434 Report := TReport.Create; 440 Report.Base := System;435 Report.Base := Core.System; 441 436 SelectedObject := TChronisObject.Create; 442 SelectedObject.Base := System;437 SelectedObject.Base := Core.System; 443 438 RegistryRootKey := HKEY_CURRENT_USER; 444 439 RegistryKey := '\Software\' + ApplicationInfo.CompanyName + '\' + … … 453 448 TreeState.Free; 454 449 PersistentForm.Free; 455 System.Free;456 450 end; 457 451 … … 564 558 PersistentForm.Load(Self); 565 559 LoadFromRegistry; 566 System.Database.Connect;560 Core.System.Database.Connect; 567 561 InitStructure; 568 System.LoadTypes;562 Core.System.LoadTypes; 569 563 LoadTree; 570 564 end; … … 645 639 try 646 640 DbRows := TDbRows.Create; 647 System.Database.Query(DbRows, 'SELECT * FROM `' + ObjectGroupTable + '`');641 Core.System.Database.Query(DbRows, 'SELECT * FROM `' + ObjectGroupTable + '`'); 648 642 for I := 0 to DbRows.Count - 1 do begin 649 643 NewNode := AddChild(TopItem, DbRows[I].Values['Name']); … … 653 647 try 654 648 ObjectDbRows := TDbRows.Create; 655 System.Database.Query(ObjectDbRows, 'SELECT * FROM `' + ObjectTable + '` WHERE `Group`=' + DbRows[I].Values['Id']);649 Core.System.Database.Query(ObjectDbRows, 'SELECT * FROM `' + ObjectTable + '` WHERE `Group`=' + DbRows[I].Values['Id']); 656 650 for O := 0 to ObjectDbRows.Count - 1 do begin 657 651 NewObjectNode := AddChild(NewNode, ObjectDbRows[O].Values['Name']);
Note:
See TracChangeset
for help on using the changeset viewer.