Changeset 28 for trunk/DbEngines/UEngineXML.pas
- Timestamp:
- Sep 10, 2022, 10:21:48 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DbEngines/UEngineXML.pas
r26 r28 37 37 function TableCreateIfNotExists(Name: string): TTable; 38 38 function FieldCreateIfNotExists(TableName, FieldName: string; DataType: TDataType): TField; 39 protected40 39 public 41 40 procedure Query(Text: string; DbRows: TDbRows = nil); override; … … 101 100 Row.Values.Count := Row.Parent.Fields.Count; 102 101 for I := 0 to Row.Values.Count - 1 do 103 Row.Values[I] := TValueClass( TField(Row.Parent.Fields[I]).GetValueClass).Create;102 Row.Values[I] := TValueClass(Row.Parent.Fields[I].GetValueClass).Create; 104 103 105 104 Node2 := Node.FirstChild; 106 105 I := 0; 107 106 while Assigned(Node2) and (Node2.NodeName = 'Value') and (I < Row.Values.Count) do begin 108 case TField(Row.Parent.Fields[I]).DataType.FieldType of107 case Row.Parent.Fields[I].DataType.FieldType of 109 108 ftString: TValueString(Row.Values[I]).Value := string(Node2.TextContent); 110 109 ftInteger: TValueInteger(Row.Values[I]).Value := StrToInt(string(Node2.TextContent)); … … 126 125 NewNode := Node.OwnerDocument.CreateElement('Value'); 127 126 Node.AppendChild(NewNode); 128 case TField(Row.Parent.Fields[I]).DataType.FieldType of127 case Row.Parent.Fields[I].DataType.FieldType of 129 128 ftString: NewNode.TextContent := UnicodeString(TValueString(Row.Values[I]).Value); 130 129 ftInteger: NewNode.TextContent := UnicodeString(IntToStr(TValueInteger(Row.Values[I]).Value)); … … 160 159 NewNode := Node.OwnerDocument.CreateElement('Record'); 161 160 Node.AppendChild(NewNode); 162 SaveNodeRecord( TRecord(Records.Items[I]), NewNode);161 SaveNodeRecord(Records[I], NewNode); 163 162 end; 164 163 end; … … 204 203 NewNode := Node.OwnerDocument.CreateElement('Field'); 205 204 Node.AppendChild(NewNode); 206 SaveNodeField( TField(Fields.Items[I]), NewNode);205 SaveNodeField(Fields[I], NewNode); 207 206 end; 208 207 end; … … 264 263 NewNode := Node.OwnerDocument.CreateElement('Table'); 265 264 Node.AppendChild(NewNode); 266 SaveNodeTable(T Table(Tables.Items[I]), NewNode);265 SaveNodeTable(Tables[I], NewNode); 267 266 end; 268 267 end; … … 647 646 if FileExists(FileName) then 648 647 LoadFromFile(FileName); 649 (* 648 649 (* 650 650 TableCreateIfNotExists('Model'); 651 651 TableCreateIfNotExists('ModelField'); … … 677 677 begin 678 678 Tables := TTables.Create; 679 inherited Create;679 inherited; 680 680 end; 681 681 682 682 destructor TDatabaseXML.Destroy; 683 683 begin 684 Tables.Free; 685 inherited Destroy; 686 end; 687 684 FreeAndNil(Tables); 685 inherited; 686 end; 688 687 689 688 end.
Note:
See TracChangeset
for help on using the changeset viewer.