Ignore:
Timestamp:
Sep 10, 2022, 10:54:56 PM (20 months ago)
Author:
chronos
Message:
  • Fixed: Load table fields in records list and record edit form.
  • Fixed: Record add needs to insert new row into database.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DbEngines/UEngineXML.pas

    r28 r29  
    9898  I: Integer;
    9999begin
    100   Row.Values.Count := Row.Parent.Fields.Count;
     100  Row.Values.Count := Row.Table.Fields.Count;
    101101  for I := 0 to Row.Values.Count - 1 do
    102     Row.Values[I] := TValueClass(Row.Parent.Fields[I].GetValueClass).Create;
     102    Row.Values[I] := TValueClass(Row.Table.Fields[I].GetValueClass).Create;
    103103
    104104  Node2 := Node.FirstChild;
    105105  I := 0;
    106106  while Assigned(Node2) and (Node2.NodeName = 'Value') and (I < Row.Values.Count) do begin
    107     case Row.Parent.Fields[I].DataType.FieldType of
     107    case Row.Table.Fields[I].DataType.FieldType of
    108108      ftString: TValueString(Row.Values[I]).Value := string(Node2.TextContent);
    109109      ftInteger: TValueInteger(Row.Values[I]).Value := StrToInt(string(Node2.TextContent));
     
    125125    NewNode := Node.OwnerDocument.CreateElement('Value');
    126126    Node.AppendChild(NewNode);
    127     case Row.Parent.Fields[I].DataType.FieldType of
     127    case Row.Table.Fields[I].DataType.FieldType of
    128128      ftString: NewNode.TextContent := UnicodeString(TValueString(Row.Values[I]).Value);
    129129      ftInteger: NewNode.TextContent := UnicodeString(IntToStr(TValueInteger(Row.Values[I]).Value));
     
    144144  while Assigned(Node2) and (Node2.NodeName = 'Record') do begin
    145145    NewRecord := TRecord.Create;
    146     NewRecord.Parent := Records.Parent;
     146    NewRecord.Table := Records.Table;
    147147    LoadNodeRecord(NewRecord, Node2);
    148148    Records.Add(NewRecord);
     
    492492        if Assigned(Field) then begin
    493493          FieldIndex := Table.Fields.IndexOf(Field);
    494           TValue(Row.Values[FieldIndex]).SetString(InsertValues.ValueFromIndex[ValueIndex]);
     494          Row.Values[FieldIndex].SetString(InsertValues.ValueFromIndex[ValueIndex]);
    495495        end else raise Exception.Create(Format(SColumnNotFoundInTable,
    496496          [InsertValues.Names[ValueIndex], TableName]));
Note: See TracChangeset for help on using the changeset viewer.