Changeset 14 for trunk/USystem.pas
- Timestamp:
- Jun 10, 2011, 2:16:52 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/USystem.pas
r13 r14 7 7 uses 8 8 Classes, SysUtils, SpecializedList, SpecializedDictionary, USqlDatabase, 9 Strings ;9 Strings, UDataTypes; 10 10 11 11 const … … 21 21 TypeRelationOne = 'TypeRelationOne'; 22 22 TypeRelationMany = 'TypeRelationMany'; 23 CustomType = 'TypeCustom';23 CustomTypeTableName = 'TypeCustom'; 24 24 Enumeration = 'Enumeration'; 25 25 EnumerationState = 'EnumerationState'; … … 45 45 TReportColumn = class 46 46 Caption: string; 47 TypeDef: TChronisType; 47 //TypeDef: TChronisType; 48 CustomType: TDataType; 48 49 ColumnName: string; 49 50 end; … … 80 81 Id: Integer; 81 82 DbType: string; 82 DbTable: string;83 83 TypeIndex: Integer; 84 Parent: TChronisType;85 84 end; 86 85 … … 178 177 NewColumn.Caption := 'Id'; 179 178 NewColumn.ColumnName := 'Id'; 180 NewColumn.TypeDef := Base.Types.FindByTypeIndex(Integer(vtInteger)); 179 NewColumn.CustomType := TDataTypeNumber.Create; 180 181 181 for I := 0 to Properties.Count - 1 do 182 if Properties[I].Values[' Type'] <> IntToStr(Integer(vtRelationMany)) then begin182 if Properties[I].Values['CustomType'] <> IntToStr(Integer(vtRelationMany)) then begin 183 183 NewColumn := TReportColumn.Create; 184 184 Columns.Add(NewColumn); 185 185 NewColumn.Caption := Properties[I].Values['Name']; 186 186 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'])); 190 188 end; 191 189 … … 204 202 NewItem.Id := StrToInt(Values[I].Values[Obj.PrimaryKey]); 205 203 for C := 0 to Properties.Count - 1 do 206 if Properties[C].Values[' Type'] <> IntToStr(Integer(vtRelationMany)) then begin204 if Properties[C].Values['CustomType'] <> IntToStr(Integer(vtRelationMany)) then begin 207 205 NewItem.Items.Add(Values[I].Values[Properties[C].Values['ColumnName']]); 208 206 end; … … 225 223 Data.Add('Name', Name); 226 224 Data.Add('DbType', DataType); 227 Data.Add(' TypeIndex', IntToStr(Integer(TypeIndex)));225 Data.Add('Id', IntToStr(Integer(TypeIndex))); 228 226 Database.Insert(PropertyTypeTable, Data); 229 227 Result := Database.LastInsertId; … … 291 289 Data.Clear; 292 290 Data.Add('Type', IntToStr(Integer(vtInteger))); 293 Database.Insert(CustomType , Data);291 Database.Insert(CustomTypeTableName, Data); 294 292 CustomTypeId := Database.LastInsertId; 295 293 … … 322 320 Data.Clear; 323 321 Data.Add('Type', IntToStr(Integer(vtString))); 324 Database.Insert(CustomType , Data);322 Database.Insert(CustomTypeTableName, Data); 325 323 CustomTypeId := Database.LastInsertId; 326 324 … … 330 328 Data.Add('Default', Default); 331 329 Database.Insert(TypeString, Data); 332 CustomTypeId := Database.LastInsertId;330 //CustomTypeId := Database.LastInsertId; 333 331 334 332 Result := AddProperty(ObjectId, Name, ColumnName, CustomTypeId); … … 405 403 with DbRows[I] do begin 406 404 Id := StrToInt(Values['Id']); 407 TypeIndex := StrToInt(Values['TypeIndex']);408 405 DbType := Values['DbType']; 409 406 //Parent := StrToInt(Values['Parent']);
Note:
See TracChangeset
for help on using the changeset viewer.