Changeset 14
- Timestamp:
- Mar 22, 2018, 7:59:13 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DbEngines/UEngineMySQL.pas
r13 r14 6 6 7 7 uses 8 Classes, SysUtils, UDatabase, USqlDatabase, UHtmlClasses, SpecializedDictionary;8 Classes, Dialogs, SysUtils, UDatabase, USqlDatabase, UHtmlClasses, SpecializedDictionary; 9 9 10 10 type … … 32 32 var 33 33 DbRows: TDbRows; 34 DbRows2: TDbRows; 34 35 NewField: TField; 35 36 I: Integer; 36 37 DataType: Integer; 38 TypeName: string; 37 39 begin 38 40 DbRows := TDbRows.Create; 41 DbRows2 := TDbRows.Create; 39 42 try 40 43 SqlDatabase.Query(DbRows, 'SELECT * FROM `ModelField` WHERE `Model` = ' + IntToStr(Table.Id) + ''); … … 44 47 NewField.Name := TDictionaryStringString(DbRows[I]).Values['Name']; 45 48 NewField.TextBefore := TDictionaryStringString(DbRows[I]).Values['Title']; 46 DataType := StrToInt(TDictionaryStringString(DbRows[I]).Values['DataType']); 47 NewField.DataType := Table.Database.Engine.DataTypes.FindByType(TFieldType(DataType)); 48 if not Assigned(NewField.DataType) then 49 DataType := StrToInt(TDictionaryStringString(DbRows[I]).Values['Type']); 50 SqlDatabase.Query(DbRows2, 'SELECT * FROM `DataType` WHERE `Id` = ' + IntToStr(DataType) + ''); 51 if DbRows2.Count > 0 then begin 52 TypeName := TDictionaryStringString(DbRows2[0]).Values['Name']; 53 NewField.DataType := Table.Database.Engine.DataTypes.FindByName(TypeName); 54 if not Assigned(NewField.DataType) then 55 NewField.DataType := Table.Database.Engine.DataTypes.FindByType(ftString); 56 end else begin 57 // Use string as default 49 58 NewField.DataType := Table.Database.Engine.DataTypes.FindByType(ftString); 59 end; 50 60 Table.Fields.Add(NewField); 51 61 end; 52 62 finally 53 63 DbRows.Free; 64 DbRows2.Free; 54 65 end; 55 66 end; … … 72 83 NewTable.Caption := TDictionaryStringString(DbRows[I]).Values['Title']; 73 84 LoadFields(NewTable); 74 DbRows2 := TDbRows.Create;75 try76 SqlDatabase.Query(DbRows2, 'SELECT COUNT(*) FROM `' + NewTable.Name + '`');77 if DbRows2.Count = 1 then78 NewTable.RecordsCount := StrToInt(DbRows2[0].Values['COUNT(*)']);79 finally80 DbRows2.Free;81 end;82 85 Database.Tables.Add(NewTable); 83 86 end; -
trunk/Forms/UFormField.pas
r8 r14 94 94 ComboBoxType.Items.Add(''); 95 95 for I := 0 to Count - 1 do begin 96 ComboBoxType.Items.Strings[I] := TDataType(Items[I]). Name;96 ComboBoxType.Items.Strings[I] := TDataType(Items[I]).Title; 97 97 ComboBoxType.Items.Objects[I] := Items[I]; 98 98 end; -
trunk/Forms/UFormFields.pas
r11 r14 131 131 with TField(Fields[Item.Index]) do begin 132 132 Item.Caption := Name; 133 Item.SubItems.Add(DataType. Name);133 Item.SubItems.Add(DataType.Title); 134 134 Item.SubItems.Add(BoolToStr(Required)); 135 135 Item.SubItems.Add(TextBefore); -
trunk/Forms/UFormMain.lfm
r11 r14 12 12 OnShow = FormShow 13 13 LCLVersion = '1.5' 14 WindowState = wsMaximized 14 15 object StatusBar1: TStatusBar 15 16 Left = 0 -
trunk/Forms/UFormRecord.pas
r8 r14 87 87 NewControl: TControl; 88 88 CellRect: TRect; 89 const 90 LabelWidth = 300; 89 91 begin 90 92 Row := DataRecord; … … 92 94 Labels.Clear; 93 95 for I := 0 to Table.Fields.Count - 1 do begin 94 CellRect := Rect(10, 10 + I * 70, Panel1.Width - 20, (I + 1) * 70);96 CellRect := Rect(10, 10 + I * 35, Panel1.Width - 20, (I + 1) * 35); 95 97 NewLabel := TLabel.Create(Panel1); 96 98 NewLabel.Caption := TField(Table.Fields[I]).TextBefore; … … 103 105 ftString: begin 104 106 NewControl := TEdit.Create(Panel1); 105 NewControl.Parent := Panel1; 106 NewControl.Left := CellRect.Left; 107 NewControl.Top := CellRect.Top + NewLabel.Height + 6; 108 NewControl.Width := CellRect.Right - CellRect.Left; 107 NewControl.Anchors := [akLeft, akTop, akRight]; 108 NewControl.Parent := Panel1; 109 NewControl.Left := CellRect.Left + LabelWidth; 110 NewControl.Top := CellRect.Top; 111 NewControl.Width := CellRect.Right - CellRect.Left - LabelWidth; 109 112 NewControl.Visible := True; 110 113 TEdit(NewControl).Text := TValueString(Row.Values[I]).Value; … … 114 117 NewControl := TSpinEdit.Create(Panel1); 115 118 NewControl.Parent := Panel1; 116 NewControl.Left := CellRect.Left ;117 NewControl.Top := CellRect.Top + NewLabel.Height + 6;118 NewControl.Width := CellRect.Right - CellRect.Left ;119 NewControl.Left := CellRect.Left + LabelWidth; 120 NewControl.Top := CellRect.Top; 121 NewControl.Width := CellRect.Right - CellRect.Left - LabelWidth; 119 122 NewControl.Visible := True; 120 123 TSpinEdit(NewControl).Value := TValueInteger(Row.Values[I]).Value; … … 124 127 NewControl := TDateEdit.Create(Panel1); 125 128 NewControl.Parent := Panel1; 126 NewControl.Left := CellRect.Left ;127 NewControl.Top := CellRect.Top + NewLabel.Height + 6;128 NewControl.Width := CellRect.Right - CellRect.Left ;129 NewControl.Left := CellRect.Left + LabelWidth; 130 NewControl.Top := CellRect.Top; 131 NewControl.Width := CellRect.Right - CellRect.Left - LabelWidth; 129 132 NewControl.Visible := True; 130 133 TDateEdit(NewControl).Date := TValueDateTime(Row.Values[I]).Value; … … 134 137 NewControl := TCheckBox.Create(Panel1); 135 138 NewControl.Parent := Panel1; 136 NewControl.Left := CellRect.Left ;137 NewControl.Top := CellRect.Top + NewLabel.Height + 6;138 NewControl.Width := CellRect.Right - CellRect.Left ;139 NewControl.Left := CellRect.Left + LabelWidth; 140 NewControl.Top := CellRect.Top; 141 NewControl.Width := CellRect.Right - CellRect.Left - LabelWidth; 139 142 NewControl.Visible := True; 140 143 TCheckBox(NewControl).Checked := TValueBoolean(Row.Values[I]).Value; … … 144 147 NewControl := TFloatSpinEdit.Create(Panel1); 145 148 NewControl.Parent := Panel1; 146 NewControl.Left := CellRect.Left ;147 NewControl.Top := CellRect.Top + NewLabel.Height + 6;148 NewControl.Width := CellRect.Right - CellRect.Left ;149 NewControl.Left := CellRect.Left + LabelWidth; 150 NewControl.Top := CellRect.Top; 151 NewControl.Width := CellRect.Right - CellRect.Left - LabelWidth; 149 152 NewControl.Visible := True; 150 153 TFloatSpinEdit(NewControl).Value := TValueFloat(Row.Values[I]).Value; 154 Controls.Add(NewControl); 155 end; 156 ftImage: begin 157 NewControl := TImage.Create(Panel1); 158 NewControl.Parent := Panel1; 159 NewControl.Left := CellRect.Left + LabelWidth; 160 NewControl.Top := CellRect.Top; 161 NewControl.Width := CellRect.Right - CellRect.Left - LabelWidth; 162 NewControl.Height := NewLabel.Height; 163 NewControl.Visible := True; 164 //TImage(NewControl).Value := TValueFloat(Row.Values[I]).Value; 165 Controls.Add(NewControl); 166 end; 167 ftReference: begin 168 NewControl := TComboBox.Create(Panel1); 169 NewControl.Parent := Panel1; 170 NewControl.Left := CellRect.Left + LabelWidth; 171 NewControl.Top := CellRect.Top; 172 NewControl.Width := CellRect.Right - CellRect.Left - LabelWidth; 173 NewControl.Height := NewLabel.Height; 174 NewControl.Visible := True; 175 176 TComboBox(NewControl).Items.Add(IntToStr(TValueReference(Row.Values[I]).Value)); 151 177 Controls.Add(NewControl); 152 178 end; … … 166 192 ftBoolean: TValueBoolean(Row.Values[I]).Value := TCheckBox(Controls[I]).Checked; 167 193 ftFloat: TValueFloat(Row.Values[I]).Value := TFloatSpinEdit(Controls[I]).Value; 194 //ftImage: TValueFloat(Row.Values[I]).Value := TFloatSpinEdit(Controls[I]).Value; 168 195 end; 169 196 end; -
trunk/Languages/MyData.cs.po
r13 r14 378 378 msgstr "Pozice na mapě" 379 379 380 #: ucore.stypereference 381 msgid "Reference" 382 msgstr "" 383 380 384 #: ucore.stypestring 381 385 msgid "String" … … 429 433 msgid "Database query error: \"%s\"" 430 434 msgstr "Chyba požadavku databáze: \"%s\"" 435 -
trunk/Languages/MyData.po
r13 r14 369 369 msgstr "" 370 370 371 #: ucore.stypereference 372 msgid "Reference" 373 msgstr "" 374 371 375 #: ucore.stypestring 372 376 msgid "String" -
trunk/MyData.lpi
r13 r14 111 111 <HasResources Value="True"/> 112 112 <ResourceBaseClass Value="Form"/> 113 <UnitName Value="UFormTables"/>114 113 </Unit1> 115 114 <Unit2> 116 115 <Filename Value="UDatabase.pas"/> 117 116 <IsPartOfProject Value="True"/> 118 <UnitName Value="UDatabase"/>119 117 </Unit2> 120 118 <Unit3> … … 124 122 <HasResources Value="True"/> 125 123 <ResourceBaseClass Value="DataModule"/> 126 <UnitName Value="UCore"/>127 124 </Unit3> 128 125 <Unit4> 129 126 <Filename Value="DbEngines/UEngineXML.pas"/> 130 127 <IsPartOfProject Value="True"/> 131 <UnitName Value="UEngineXML"/>132 128 </Unit4> 133 129 <Unit5> … … 144 140 <HasResources Value="True"/> 145 141 <ResourceBaseClass Value="Form"/> 146 <UnitName Value="UFormRecords"/>147 142 </Unit6> 148 143 <Unit7> … … 152 147 <HasResources Value="True"/> 153 148 <ResourceBaseClass Value="Form"/> 154 <UnitName Value="UFormRecord"/>155 149 </Unit7> 156 150 <Unit8> … … 171 165 <Filename Value="UDataTypes.pas"/> 172 166 <IsPartOfProject Value="True"/> 173 <UnitName Value="UDataTypes"/>174 167 </Unit10> 175 168 <Unit11> 176 169 <Filename Value="DbEngines/UEngineMySQL.pas"/> 177 170 <IsPartOfProject Value="True"/> 178 <UnitName Value="UEngineMySQL"/>179 171 </Unit11> 180 172 <Unit12> 181 173 <Filename Value="DbEngines/UEngineSQLite.pas"/> 182 174 <IsPartOfProject Value="True"/> 183 <UnitName Value="UEngineSQLite"/>184 175 </Unit12> 185 176 <Unit13> … … 203 194 <HasResources Value="True"/> 204 195 <ResourceBaseClass Value="Form"/> 205 <UnitName Value="UFormDatabases"/>206 196 </Unit15> 207 197 <Unit16> -
trunk/Packages/CoolWeb/Persistence/USqlDatabase.pas
r12 r14 149 149 TimeParts: TListString; 150 150 begin 151 if Value = '' then Result := 0 else 151 152 try 152 153 Parts := TListString.Create; … … 156 157 Parts.Explode(Value, ' ', StrToStr); 157 158 DateParts.Explode(Parts[0], '-', StrToStr); 159 if (StrToInt(DateParts[0]) = 0) or (StrToInt(DateParts[1]) = 0) or 160 (StrToInt(DateParts[2]) = 0) then Result := 0 else 158 161 Result := EncodeDate(StrToInt(DateParts[0]), StrToInt(DateParts[1]), 159 162 StrToInt(DateParts[2])); -
trunk/Packages/TemplateGenerics/Generic/GenericDictionary.inc
r10 r14 91 91 Result := Result + 1; 92 92 end; 93 if Result >= Count then Result := -1; 93 94 end; 94 95 -
trunk/Packages/TemplateGenerics/Generic/GenericMatrix.inc
r10 r14 50 50 function Implode(RowSeparator, ColSeparator: string; Converter: TToStringConverter): string; 51 51 procedure Explode(Text, Separator: string; Converter: TFromStringConverter; SlicesCount: Integer = -1); 52 function IndexOf(Item: TGMatrixItem; Start: TIndex = 0): TIndex;53 function IndexOfList(List: TGMatrix; Start: TIndex = 0): TIndex;52 function IndexOf(Item: TGMatrixItem; Start: TIndex): TIndex; 53 function IndexOfList(List: TGMatrix; Start: TIndex): TIndex; 54 54 procedure Insert(Index: TIndex; Item: TGMatrixItem); 55 55 procedure InsertList(Index: TIndex; List: TGMatrix); -
trunk/UCore.lfm
r11 r14 1425 1425 end 1426 1426 object XMLConfig1: TXMLConfig 1427 Filename = 'Config.xml'1428 1427 StartEmpty = False 1429 1428 RootName = 'CONFIG' 1429 ReadOnly = False 1430 1430 left = 294 1431 1431 top = 216 -
trunk/UCore.pas
r13 r14 68 68 STypeTime = 'Time'; 69 69 STypeDateTime = 'Date and time'; 70 STypeReference = 'Reference'; 70 71 71 72 { TCore } … … 109 110 begin 110 111 for I := 0 to DataTypes.Count - 1 do begin 111 TDataType(DataTypes[I]). Name := CoolTranslator1.TranslateText(TDataType(DataTypes[I]).Name, TDataType(DataTypes[I]).Name);112 TDataType(DataTypes[I]).Title := CoolTranslator1.TranslateText(TDataType(DataTypes[I]).Title, TDataType(DataTypes[I]).Title); 112 113 end; 113 114 end; … … 130 131 131 132 NewEngine := Engines.RegisterEngine('MySQL', TDatabaseMySQL); 132 NewEngine.UseTypes(DataTypes, [ftString, ftInteger, ftDateTime, ftBoolean, ftFloat]); 133 NewEngine.UseTypes(DataTypes, [ftString, ftInteger, ftDateTime, ftBoolean, ftFloat, 134 ftReference]); 133 135 134 136 NewEngine := Engines.RegisterEngine('SQLite', TDatabaseSQLite); … … 140 142 DataTypes.Clear; 141 143 with DataTypes do begin 142 RegisterType(1, STypeString, ftString, TFieldString); 143 RegisterType(2, STypeInteger, ftInteger, TFieldInteger); 144 RegisterType(3, STypeDateTime, ftDateTime, TFieldDateTime); 145 RegisterType(4, STypeBoolean, ftBoolean, TFieldBoolean); 146 RegisterType(5, STypeFloat, ftFloat, TFieldFloat); 147 RegisterType(6, STypeMapPosition, ftMapPosition, TFieldMapPosition); 148 RegisterType(7, STypeDate, ftDate, TFieldDate); 149 RegisterType(8, STypeTime, ftTime, TFieldTime); 150 RegisterType(9, STypeImage, ftImage, TFieldImage); 144 RegisterType(1, 'String', STypeString, ftString, TFieldString); 145 RegisterType(2, 'Integer', STypeInteger, ftInteger, TFieldInteger); 146 RegisterType(3, 'DateTime', STypeDateTime, ftDateTime, TFieldDateTime); 147 RegisterType(4, 'Boolean', STypeBoolean, ftBoolean, TFieldBoolean); 148 RegisterType(5, 'Float', STypeFloat, ftFloat, TFieldFloat); 149 RegisterType(6, 'MapPosition', STypeMapPosition, ftMapPosition, TFieldMapPosition); 150 RegisterType(7, 'Date', STypeDate, ftDate, TFieldDate); 151 RegisterType(8, 'Time', STypeTime, ftTime, TFieldTime); 152 RegisterType(9, 'Image', STypeImage, ftImage, TFieldImage); 153 RegisterType(10, 'Reference', STypeReference, ftReference, TFieldReference); 151 154 end; 152 155 end; … … 174 177 Engine: TDatabaseEngine; 175 178 begin 179 XMLConfig1.FileName := 'Config.xml'; 176 180 Databases.Count := XMLConfig1.GetValue('Database/Count', 0); 177 181 for I := 0 to Databases.Count - 1 do begin -
trunk/UDataTypes.pas
r13 r14 6 6 7 7 uses 8 Classes, SysUtils, UDatabase, Contnrs ;8 Classes, SysUtils, UDatabase, Contnrs, USqlDatabase; 9 9 10 10 type … … 15 15 procedure Assign(Source: TValue); override; 16 16 function GetString: string; override; 17 function SetString(Value: string): string; override;17 procedure SetString(Value: string); override; 18 18 end; 19 19 … … 24 24 procedure Assign(Source: TValue); override; 25 25 function GetString: string; override; 26 function SetString(Value: string): string; override;26 procedure SetString(Value: string); override; 27 27 end; 28 28 … … 33 33 procedure Assign(Source: TValue); override; 34 34 function GetString: string; override; 35 function SetString(Value: string): string; override; 35 procedure SetString(Value: string); override; 36 end; 37 38 { TValueDate } 39 40 TValueDate = class(TValueDateTime) 41 end; 42 43 { TValueTime } 44 45 TValueTime = class(TValueDateTime) 36 46 end; 37 47 … … 42 52 procedure Assign(Source: TValue); override; 43 53 function GetString: string; override; 44 function SetString(Value: string): string; override;54 procedure SetString(Value: string); override; 45 55 end; 46 56 … … 51 61 procedure Assign(Source: TValue); override; 52 62 function GetString: string; override; 53 function SetString(Value: string): string; override; 63 procedure SetString(Value: string); override; 64 end; 65 66 { TValueReference } 67 68 TValueReference = class(TValueInteger) 54 69 end; 55 70 … … 94 109 Min: TDate; 95 110 Max: TDate; 96 end; 111 procedure Assign(Source: TFieldTypeSpecific); override; 112 function GetValueClass: TValueClass; override; 113 end; 114 115 { TFieldTime } 97 116 98 117 TFieldTime = class(TFieldTypeSpecific) 99 118 Min: TTime; 100 119 Max: TTime; 120 procedure Assign(Source: TFieldTypeSpecific); override; 121 function GetValueClass: TValueClass; override; 101 122 end; 102 123 … … 106 127 end; 107 128 129 { TFieldReference } 130 131 TFieldReference = class(TFieldTypeSpecific) 132 TableName: string; 133 Id: Integer; 134 procedure Assign(Source: TFieldTypeSpecific); override; 135 function GetValueClass: TValueClass; override; 136 end; 137 108 138 { TFieldBoolean } 109 139 … … 120 150 implementation 121 151 152 { TFieldReference } 153 154 procedure TFieldReference.Assign(Source: TFieldTypeSpecific); 155 begin 156 if Source is TFieldReference then begin 157 Id := TFieldReference(Source).Id; 158 TableName := TFieldReference(Source).TableName; 159 end; 160 end; 161 162 function TFieldReference.GetValueClass: TValueClass; 163 begin 164 Result := TValueReference; 165 end; 166 167 { TFieldTime } 168 169 procedure TFieldTime.Assign(Source: TFieldTypeSpecific); 170 begin 171 if Source is TFieldTime then begin 172 Min := TFieldTime(Source).Min; 173 Max := TFieldTime(Source).Max; 174 end; 175 end; 176 177 function TFieldTime.GetValueClass: TValueClass; 178 begin 179 Result := TValueTime; 180 end; 181 182 { TFieldDate } 183 184 procedure TFieldDate.Assign(Source: TFieldTypeSpecific); 185 begin 186 if Source is TFieldDate then begin 187 Min := TFieldDate(Source).Min; 188 Max := TFieldDate(Source).Max; 189 end; 190 end; 191 192 function TFieldDate.GetValueClass: TValueClass; 193 begin 194 Result := TValueDate; 195 end; 196 122 197 123 198 { TValueFloat } … … 134 209 end; 135 210 136 function TValueFloat.SetString(Value: string): string;211 procedure TValueFloat.SetString(Value: string); 137 212 begin 138 213 Self.Value := StrToFloat(Value); … … 198 273 end; 199 274 200 function TValueBoolean.SetString(Value: string): string;275 procedure TValueBoolean.SetString(Value: string); 201 276 begin 202 277 Self.Value := StrToBool(Value); … … 216 291 end; 217 292 218 function TValueInteger.SetString(Value: string): string; 219 begin 220 Self.Value := StrToInt(Value); 293 procedure TValueInteger.SetString(Value: string); 294 var 295 IntVal: Integer; 296 begin 297 if TryStrToInt(Value, IntVal) then Self.Value := IntVal; 221 298 end; 222 299 … … 225 302 procedure TFieldDateTime.Assign(Source: TFieldTypeSpecific); 226 303 begin 227 if Source is TFieldDate then begin228 Min := TFieldDate (Source).Min;229 Max := TFieldDate (Source).Max;304 if Source is TFieldDateTime then begin 305 Min := TFieldDateTime(Source).Min; 306 Max := TFieldDateTime(Source).Max; 230 307 end; 231 308 end; … … 249 326 end; 250 327 251 function TValueDateTime.SetString(Value: string): string; 252 begin 253 Self.Value := StrToDateTime(Value); 328 procedure TValueDateTime.SetString(Value: string); 329 begin 330 Self.Value := SQLToDateTime(Value); 331 // if not TryStrToDateTime(Value, Self.Value) then begin 332 // end; 254 333 end; 255 334 … … 267 346 end; 268 347 269 function TValueString.SetString(Value: string): string;348 procedure TValueString.SetString(Value: string); 270 349 begin 271 350 Self.Value := Value; -
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.