Changeset 24 for trunk/USystem.pas


Ignore:
Timestamp:
Oct 21, 2011, 11:12:09 PM (13 years ago)
Author:
george
Message:
  • Add: Support for storing module skeleton.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/USystem.pas

    r22 r24  
    1616  PropertyTypeTable = 'Type';
    1717  PropertyGroupTable = 'PropertyGroup';
     18  ModuleTable = 'Module';
    1819  TypeEnumeration = 'TypeEnumeration';
    1920  TypeFile = 'TypeFile';
     
    119120    function AddPropertyString(ObjectId: Integer; Name, ColumnName: string;
    120121      Editable: Boolean; Default: string = ''; MaxLength: Integer = 255): Integer;
     122    function AddPropertyText(ObjectId: Integer; Name, ColumnName: string;
     123      Editable: Boolean; Default: string = ''): Integer;
    121124    function AddPropertyRelationOne(ObjectId: Integer; Name, ColumnName: string;
    122125      Editable: Boolean; ReferedObject: Integer): Integer;
     
    126129    function AddEnumeration(Name: string): Integer;
    127130    function AddEnumerationState(Enum: Integer; Name: string): Integer;
     131    function AddModule(Name, Author, Website, Version, Description, License: string): Integer;
    128132    procedure LoadTypes;
    129133    constructor Create;
     
    435439end;
    436440
     441function TChronisBase.AddPropertyText(ObjectId: Integer; Name,
     442  ColumnName: string; Editable: Boolean; Default: string): Integer;
     443var
     444  DbRows: TDbRows;
     445  Data: TDictionaryStringString;
     446  CustomTypeId: Integer;
     447begin
     448  try
     449    DbRows := TDbRows.Create;
     450    Data := TDictionaryStringString.Create;
     451
     452    Data.Clear;
     453    Data.Add('Type', IntToStr(Integer(vtText)));
     454    Database.Insert(CustomTypeTableName, Data);
     455    CustomTypeId := Database.LastInsertId;
     456
     457    Data.Clear;
     458    Data.Add('CustomType', IntToStr(CustomTypeId));
     459    Data.Add('Default', Default);
     460    Database.Insert(TypeString, Data);
     461    //CustomTypeId := Database.LastInsertId;
     462
     463    Result := AddProperty(ObjectId, Name, ColumnName, CustomTypeId, Editable);
     464  finally
     465    Data.Free;
     466    DbRows.Free;
     467  end;
     468end;
     469
    437470function TChronisBase.AddPropertyRelationOne(ObjectId: Integer; Name,
    438471  ColumnName: string; Editable: Boolean; ReferedObject: Integer): Integer;
     
    539572    Data.Add('Name', Name);
    540573    Database.Insert(EnumerationState, Data);
     574    Result := Database.LastInsertId;
     575  finally
     576    Data.Free;
     577    DbRows.Free;
     578  end;
     579end;
     580
     581function TChronisBase.AddModule(Name, Author, Website, Version, Description,
     582  License: string): Integer;
     583var
     584  DbRows: TDbRows;
     585  Data: TDictionaryStringString;
     586begin
     587  try
     588    DbRows := TDbRows.Create;
     589    Data := TDictionaryStringString.Create;
     590    Data.Add('Name', Name);
     591    Data.Add('Author', Author);
     592    Data.Add('Website', Website);
     593    Data.Add('Version', Version);
     594    Data.Add('Description', Description);
     595    Data.Add('License', License);
     596    Database.Insert(ModuleTable, Data);
    541597    Result := Database.LastInsertId;
    542598  finally
Note: See TracChangeset for help on using the changeset viewer.