Ignore:
Timestamp:
Jun 10, 2011, 2:16:52 PM (13 years ago)
Author:
george
Message:
  • Added: Classes for base data types.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UMainForm.pas

    r13 r14  
    104104    PersistentForm: TPersistentForm;
    105105    TreeState: TTreeState;
    106     System: TChronisBase;
    107106    Report: TReport;
    108107    procedure LoadTree;
     
    138137    OpenKey(RegistryKey, True);
    139138    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', '');
    144143    with Core.CoolTranslator1 do
    145144      Language := Languages.SearchByCode(ReadStringWithDefault('LanguageCode', ''));
     
    156155    OpenKey(RegistryKey, True);
    157156    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);
    162161    with Core.CoolTranslator1 do
    163162      WriteString('LanguageCode', Language.Code);
     
    177176  I: Integer;
    178177begin
    179   with System do
     178  with Core.System do
    180179  try
    181180    DbRows := TDbRows.Create;
     
    245244      '`Name` varchar(255) NOT NULL,' +
    246245      '`DbType` varchar(255) NOT NULL,' +
    247       '`TypeIndex` int(11) NOT NULL,' +
    248246      'PRIMARY KEY (`Id`)' +
    249247      ') ENGINE=InnoDB  DEFAULT CHARSET=utf8');
     
    326324    end;
    327325
    328     if Tables.IndexOf(CustomType) = -1 then begin
    329       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 + '` ( ' +
    330328        '`Id` int(11) NOT NULL AUTO_INCREMENT,' +
    331329        '`Type` int NOT NULL,' +
     
    373371  EnumId: Integer;
    374372begin
    375   with System do begin
     373  with Core.System do begin
    376374  TypeNumber := AddType('Number', 'INT', vtInteger);
    377375  TypeString := AddType('String', 'VARCHAR(255)', vtString);
     
    407405  GroupId := AddObjectGroup('System');
    408406
    409   ObjectId := AddObject('Object groups', 'ObjectGroup', System.Database.Database, GroupId);
     407  ObjectId := AddObject('Object groups', 'ObjectGroup', Core.System.Database.Database, GroupId);
    410408    AddPropertyString(ObjectId, 'Name', 'Name');
    411   ObjectId := AddObject('Objects', 'Object', System.Database.Database, GroupId);
     409  ObjectId := AddObject('Objects', 'Object', Core.System.Database.Database, GroupId);
    412410    AddPropertyString(ObjectId, 'Name', 'Name');
    413411    AddPropertyNumber(ObjectId, 'Group', 'Group');
     
    416414    AddPropertyString(ObjectId, 'Primary key', 'PrimaryKey');
    417415    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);
    419417    AddPropertyString(ObjectId, 'Name', 'Name');
    420418    AddPropertyString(ObjectId, 'Type', 'DbType');
    421     AddPropertyNumber(ObjectId, 'Type index', 'TypeIndex');
    422419    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);
    425422    AddPropertyString(ObjectId, 'Name', 'Name');
    426423    AddPropertyNumber(ObjectId, 'Object', 'Object');
    427     AddPropertyNumber(ObjectId, 'PropertyGroup', 'PropertyGroup');
    428     AddPropertyNumber(ObjectId, 'Type', 'Type');
     424    AddPropertyNumber(ObjectId, 'Property group', 'PropertyGroup');
     425    AddPropertyNumber(ObjectId, 'Custom type', 'CustomType');
    429426    AddProperty(ObjectId, 'Editable', 'Editable', TypeBoolean);
    430     AddPropertyString(ObjectId, 'ColumnName', 'ColumnName');
     427    AddPropertyString(ObjectId, 'Column name', 'ColumnName');
    431428  end;
    432429end;
     
    434431procedure TMainForm.FormCreate(Sender: TObject);
    435432begin
    436   System := TChronisBase.Create;
    437   System.Database := TSqlDatabase.Create;
    438433  TreeState := TTreeState.Create;
    439434  Report := TReport.Create;
    440   Report.Base := System;
     435  Report.Base := Core.System;
    441436  SelectedObject := TChronisObject.Create;
    442   SelectedObject.Base := System;
     437  SelectedObject.Base := Core.System;
    443438  RegistryRootKey := HKEY_CURRENT_USER;
    444439  RegistryKey := '\Software\' + ApplicationInfo.CompanyName + '\' +
     
    453448  TreeState.Free;
    454449  PersistentForm.Free;
    455   System.Free;
    456450end;
    457451
     
    564558  PersistentForm.Load(Self);
    565559  LoadFromRegistry;
    566   System.Database.Connect;
     560  Core.System.Database.Connect;
    567561  InitStructure;
    568   System.LoadTypes;
     562  Core.System.LoadTypes;
    569563  LoadTree;
    570564end;
     
    645639    try
    646640      DbRows := TDbRows.Create;
    647       System.Database.Query(DbRows, 'SELECT * FROM `' + ObjectGroupTable + '`');
     641      Core.System.Database.Query(DbRows, 'SELECT * FROM `' + ObjectGroupTable + '`');
    648642      for I := 0 to DbRows.Count - 1 do begin
    649643        NewNode := AddChild(TopItem, DbRows[I].Values['Name']);
     
    653647        try
    654648          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']);
    656650          for O := 0 to ObjectDbRows.Count - 1 do begin
    657651            NewObjectNode := AddChild(NewNode, ObjectDbRows[O].Values['Name']);
Note: See TracChangeset for help on using the changeset viewer.