Changeset 14 for trunk/USystem.pas


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/USystem.pas

    r13 r14  
    77uses
    88  Classes, SysUtils, SpecializedList, SpecializedDictionary, USqlDatabase,
    9   Strings;
     9  Strings, UDataTypes;
    1010
    1111const
     
    2121  TypeRelationOne = 'TypeRelationOne';
    2222  TypeRelationMany = 'TypeRelationMany';
    23   CustomType = 'TypeCustom';
     23  CustomTypeTableName = 'TypeCustom';
    2424  Enumeration = 'Enumeration';
    2525  EnumerationState = 'EnumerationState';
     
    4545  TReportColumn = class
    4646    Caption: string;
    47     TypeDef: TChronisType;
     47    //TypeDef: TChronisType;
     48    CustomType: TDataType;
    4849    ColumnName: string;
    4950  end;
     
    8081    Id: Integer;
    8182    DbType: string;
    82     DbTable: string;
    8383    TypeIndex: Integer;
    84     Parent: TChronisType;
    8584  end;
    8685
     
    178177      NewColumn.Caption := 'Id';
    179178      NewColumn.ColumnName := 'Id';
    180       NewColumn.TypeDef := Base.Types.FindByTypeIndex(Integer(vtInteger));
     179      NewColumn.CustomType := TDataTypeNumber.Create;
     180
    181181      for I := 0 to Properties.Count - 1 do
    182       if Properties[I].Values['Type'] <> IntToStr(Integer(vtRelationMany)) then begin
     182      if Properties[I].Values['CustomType'] <> IntToStr(Integer(vtRelationMany)) then begin
    183183        NewColumn := TReportColumn.Create;
    184184        Columns.Add(NewColumn);
    185185        NewColumn.Caption := Properties[I].Values['Name'];
    186186        NewColumn.ColumnName := Properties[I].Values['ColumnName'];;
    187         NewColumn.TypeDef := Base.Types.FindById(StrToInt(Properties[I].Values['Type']));
    188         if not Assigned(NewColumn.TypeDef) then
    189           raise Exception.Create(Format(SUnsupportedType, [Properties[I].Values['Type']]));
     187        NewColumn.CustomType := GetDataType(StrToInt(Properties[I].Values['CustomType']));
    190188      end;
    191189
     
    204202        NewItem.Id := StrToInt(Values[I].Values[Obj.PrimaryKey]);
    205203        for C := 0 to Properties.Count - 1 do
    206         if Properties[C].Values['Type'] <> IntToStr(Integer(vtRelationMany)) then begin
     204        if Properties[C].Values['CustomType'] <> IntToStr(Integer(vtRelationMany)) then begin
    207205          NewItem.Items.Add(Values[I].Values[Properties[C].Values['ColumnName']]);
    208206        end;
     
    225223    Data.Add('Name', Name);
    226224    Data.Add('DbType', DataType);
    227     Data.Add('TypeIndex', IntToStr(Integer(TypeIndex)));
     225    Data.Add('Id', IntToStr(Integer(TypeIndex)));
    228226    Database.Insert(PropertyTypeTable, Data);
    229227    Result := Database.LastInsertId;
     
    291289    Data.Clear;
    292290    Data.Add('Type', IntToStr(Integer(vtInteger)));
    293     Database.Insert(CustomType, Data);
     291    Database.Insert(CustomTypeTableName, Data);
    294292    CustomTypeId := Database.LastInsertId;
    295293
     
    322320    Data.Clear;
    323321    Data.Add('Type', IntToStr(Integer(vtString)));
    324     Database.Insert(CustomType, Data);
     322    Database.Insert(CustomTypeTableName, Data);
    325323    CustomTypeId := Database.LastInsertId;
    326324
     
    330328    Data.Add('Default', Default);
    331329    Database.Insert(TypeString, Data);
    332     CustomTypeId := Database.LastInsertId;
     330    //CustomTypeId := Database.LastInsertId;
    333331
    334332    Result := AddProperty(ObjectId, Name, ColumnName, CustomTypeId);
     
    405403      with DbRows[I] do begin
    406404        Id := StrToInt(Values['Id']);
    407         TypeIndex := StrToInt(Values['TypeIndex']);
    408405        DbType := Values['DbType'];
    409406        //Parent := StrToInt(Values['Parent']);
Note: See TracChangeset for help on using the changeset viewer.