Changeset 20 for trunk/USystem.pas
- Timestamp:
- Jun 15, 2011, 11:11:59 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/USystem.pas
r19 r20 27 27 TypeString = 'TypeString'; 28 28 TypeFloat = 'TypeFloat'; 29 TypeDateTime = 'TypeDateTime'; 29 30 30 31 type … … 103 104 function AddProperty(ObjectId: Integer; Name, ColumnName: string; CustomType: Integer): Integer; 104 105 function AddPropertyNumber(ObjectId: Integer; Name, 105 ColumnName: string; Default: Integer = 0; Min: Integer = 0;106 ColumnName: string; Default: Integer = 0; Min: Integer = Low(Integer); 106 107 Max: Integer = High(Integer)): Integer; 107 108 function AddPropertyFloat(ObjectId: Integer; Name, 108 ColumnName: string; Default: Integer = 0; Min: Integer = 0; 109 Max: Integer = High(Integer)): Integer; 109 ColumnName: string; Default: Double = 0; Min: Double = 0; 110 Max: Double = 0): Integer; 111 function AddPropertyDateTime(ObjectId: Integer; Name, 112 ColumnName: string; Default: TDateTime = 0; Min: TDateTime = 0; 113 Max: TDateTime = 0): Integer; 110 114 function AddPropertyString(ObjectId: Integer; Name, ColumnName: string; 111 115 Default: string = ''; MaxLength: Integer = 255): Integer; … … 307 311 308 312 function TChronisBase.AddPropertyNumber(ObjectId: Integer; Name, 309 ColumnName: string; Default: Integer = 0; Min: Integer = 0;313 ColumnName: string; Default: Integer = 0; Min: Integer = Low(Integer); 310 314 Max: Integer = High(Integer)): Integer; 311 315 var … … 339 343 340 344 function TChronisBase.AddPropertyFloat(ObjectId: Integer; Name, 341 ColumnName: string; Default: Integer; Min: Integer; Max: Integer): Integer;345 ColumnName: string; Default: Double; Min: Double; Max: Double): Integer; 342 346 var 343 347 DbRows: TDbRows; … … 356 360 Data.Clear; 357 361 Data.Add('CustomType', IntToStr(CustomTypeId)); 358 Data.Add('Min', IntToStr(Min));359 Data.Add('Max', IntToStr(Max));360 Data.Add('Default', IntToStr(Default));362 Data.Add('Min', MySQLFloatToStr(Min)); 363 Data.Add('Max', MySQLFloatToStr(Max)); 364 Data.Add('Default', MySQLFloatToStr(Default)); 361 365 Database.Insert(TypeFloat, Data); 366 //CustomTypeId := Database.LastInsertId; 367 368 Result := AddProperty(ObjectId, Name, ColumnName, CustomTypeId); 369 finally 370 Data.Free; 371 DbRows.Free; 372 end; 373 end; 374 375 function TChronisBase.AddPropertyDateTime(ObjectId: Integer; Name, 376 ColumnName: string; Default: TDateTime; Min: TDateTime; Max: TDateTime 377 ): Integer; 378 var 379 DbRows: TDbRows; 380 Data: TDictionaryStringString; 381 CustomTypeId: Integer; 382 begin 383 try 384 DbRows := TDbRows.Create; 385 Data := TDictionaryStringString.Create; 386 387 Data.Clear; 388 Data.Add('Type', IntToStr(Integer(vtDateTime))); 389 Database.Insert(CustomTypeTableName, Data); 390 CustomTypeId := Database.LastInsertId; 391 392 Data.Clear; 393 Data.Add('CustomType', IntToStr(CustomTypeId)); 394 Data.Add('Min', DateTimeToSQL(Min)); 395 Data.Add('Max', DateTimeToSQL(Max)); 396 Data.Add('Default', DateTimeToSQL(Default)); 397 Database.Insert(TypeDateTime, Data); 362 398 //CustomTypeId := Database.LastInsertId; 363 399
Note:
See TracChangeset
for help on using the changeset viewer.