Changeset 14 for trunk/UDatabase.pas
- Timestamp:
- Mar 22, 2018, 7:59:13 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UDatabase.pas
r13 r14 17 17 18 18 TFieldType = (ftString, ftInteger, ftDateTime, ftBoolean, ftFloat, ftImage, 19 ftDate, ftTime, ftMapPosition );19 ftDate, ftTime, ftMapPosition, ftReference); 20 20 21 21 { TValue } … … 24 24 procedure Assign(Source: TValue); virtual; 25 25 function GetString: string; virtual; 26 function SetString(Value: string): string; virtual; 26 procedure SetString(Value: string); virtual; 27 function GetStringSQL: string; virtual; 28 procedure SetStringSQL(Value: string); virtual; 27 29 end; 28 30 … … 151 153 Id: Integer; 152 154 Name: string; 155 Title: string; 153 156 FieldType: TFieldType; 154 157 FieldTypeClass: TFieldTypeSpecificClass; … … 158 161 159 162 TDataTypes = class(TObjectList) 160 function RegisterType(Id: Integer; Name: string; FieldType: TFieldType; FieldTypeClass: TFieldTypeSpecificClass): TDataType; 163 function RegisterType(Id: Integer; Name, Title: string; 164 FieldType: TFieldType; FieldTypeClass: TFieldTypeSpecificClass): TDataType; 161 165 function FindByType(FieldType: TFieldType): TDataType; 166 function FindByName(Name: string): TDataType; 162 167 end; 163 168 … … 272 277 { TDataTypes } 273 278 274 function TDataTypes.RegisterType(Id: Integer; Name : string; FieldType: TFieldType;275 FieldType Class: TFieldTypeSpecificClass): TDataType;279 function TDataTypes.RegisterType(Id: Integer; Name, Title: string; 280 FieldType: TFieldType; FieldTypeClass: TFieldTypeSpecificClass): TDataType; 276 281 begin 277 282 Result := TDataType.Create; 278 283 Result.Id := Id; 279 284 Result.Name := Name; 285 Result.Title := Title; 280 286 Result.FieldType := FieldType; 281 287 Result.FieldTypeClass := FieldTypeClass; … … 289 295 I := 0; 290 296 while (I < Count) and (TDataType(Items[I]).FieldType <> FieldType) do Inc(I); 297 if I < Count then Result := TDataType(Items[I]) 298 else Result := nil; 299 end; 300 301 function TDataTypes.FindByName(Name: string): TDataType; 302 var 303 I: Integer; 304 begin 305 I := 0; 306 while (I < Count) and (TDataType(Items[I]).Name <> Name) do Inc(I); 291 307 if I < Count then Result := TDataType(Items[I]) 292 308 else Result := nil; … … 408 424 end; 409 425 410 function TValue.SetString(Value: string): string; 411 begin 412 426 procedure TValue.SetString(Value: string); 427 begin 428 429 end; 430 431 function TValue.GetStringSQL: string; 432 begin 433 Result := ''; 434 end; 435 436 procedure TValue.SetStringSQL(Value: string); 437 begin 413 438 end; 414 439 … … 470 495 NewRecord: TRecord; 471 496 NewValue: TValue; 497 Index: Integer; 472 498 begin 473 499 Records.Clear; … … 478 504 for F := 0 to Fields.Count - 1 do begin 479 505 NewValue := TField(Fields[F]).GetValueClass.Create; 480 NewValue.SetString(TDictionaryStringString(DbRows[I]).Values[TField(Fields[F]).Name]); 481 NewRecord.Values.Add(NewValue); 506 Index := TDictionaryStringString(DbRows[I]).SearchKey(TField(Fields[F]).Name); 507 if Index <> -1 then begin 508 NewValue.SetString(TDictionaryStringString(DbRows[I]).Values[TField(Fields[F]).Name]); 509 NewRecord.Values.Add(NewValue); 510 end else begin 511 //NewValue.SetString(''); 512 NewRecord.Values.Add(NewValue); 513 end; 482 514 end; 483 515 Records.Add(NewRecord);
Note:
See TracChangeset
for help on using the changeset viewer.