Changeset 19 for trunk/USystem.pas
- Timestamp:
- Jun 14, 2011, 12:20:15 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/USystem.pas
r17 r19 26 26 TypeNumber = 'TypeNumber'; 27 27 TypeString = 'TypeString'; 28 TypeFloat = 'TypeFloat'; 28 29 29 30 type … … 98 99 Database: TSQLDatabase; 99 100 function AddType(Name, DataType: string; TypeIndex: TDbValueType): Integer; 101 function AddGroup(Name: string; ParentGroupId: Integer = 0): Integer; 100 102 function AddObject(Name, TableName, Schema: string; GroupId: Integer): Integer; 101 function AddProperty(ObjectId: Integer; Name, ColumnName: string; DataType: Integer): Integer;103 function AddProperty(ObjectId: Integer; Name, ColumnName: string; CustomType: Integer): Integer; 102 104 function AddPropertyNumber(ObjectId: Integer; Name, 105 ColumnName: string; Default: Integer = 0; Min: Integer = 0; 106 Max: Integer = High(Integer)): Integer; 107 function AddPropertyFloat(ObjectId: Integer; Name, 103 108 ColumnName: string; Default: Integer = 0; Min: Integer = 0; 104 109 Max: Integer = High(Integer)): Integer; … … 240 245 end; 241 246 247 function TChronisBase.AddGroup(Name: string; ParentGroupId: Integer): Integer; 248 var 249 DbRows: TDbRows; 250 Data: TDictionaryStringString; 251 begin 252 try 253 DbRows := TDbRows.Create; 254 Data := TDictionaryStringString.Create; 255 Data.Add('Name', Name); 256 Data.Add('Parent', IntToStr(ParentGroupId)); 257 Database.Insert(ObjectGroupTable, Data); 258 Result := Database.LastInsertId; 259 finally 260 Data.Free; 261 DbRows.Free; 262 end; 263 end; 264 242 265 function TChronisBase.AddObject(Name, TableName, Schema: string; 243 266 GroupId: Integer): Integer; … … 262 285 263 286 function TChronisBase.AddProperty(ObjectId: Integer; Name, ColumnName: string; 264 DataType: Integer): Integer;287 CustomType: Integer): Integer; 265 288 var 266 289 DbRows: TDbRows; … … 273 296 Data.Add('Object', IntToStr(ObjectId)); 274 297 Data.Add('ColumnName', ColumnName); 275 Data.Add('CustomType', IntToStr( DataType));298 Data.Add('CustomType', IntToStr(CustomType)); 276 299 Data.Add('Editable', '1'); 277 300 Database.Insert(PropertyTable, Data); … … 306 329 Data.Add('Default', IntToStr(Default)); 307 330 Database.Insert(TypeNumber, Data); 331 //CustomTypeId := Database.LastInsertId; 332 333 Result := AddProperty(ObjectId, Name, ColumnName, CustomTypeId); 334 finally 335 Data.Free; 336 DbRows.Free; 337 end; 338 end; 339 340 function TChronisBase.AddPropertyFloat(ObjectId: Integer; Name, 341 ColumnName: string; Default: Integer; Min: Integer; Max: Integer): Integer; 342 var 343 DbRows: TDbRows; 344 Data: TDictionaryStringString; 345 CustomTypeId: Integer; 346 begin 347 try 348 DbRows := TDbRows.Create; 349 Data := TDictionaryStringString.Create; 350 351 Data.Clear; 352 Data.Add('Type', IntToStr(Integer(vtFloat))); 353 Database.Insert(CustomTypeTableName, Data); 354 CustomTypeId := Database.LastInsertId; 355 356 Data.Clear; 357 Data.Add('CustomType', IntToStr(CustomTypeId)); 358 Data.Add('Min', IntToStr(Min)); 359 Data.Add('Max', IntToStr(Max)); 360 Data.Add('Default', IntToStr(Default)); 361 Database.Insert(TypeFloat, Data); 308 362 //CustomTypeId := Database.LastInsertId; 309 363
Note:
See TracChangeset
for help on using the changeset viewer.