Changeset 28 for trunk/DbEngines


Ignore:
Timestamp:
Sep 10, 2022, 10:21:48 PM (2 years ago)
Author:
chronos
Message:
  • Modified: Do not create all application forms at initialization phase but dynamically.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DbEngines/UEngineXML.pas

    r26 r28  
    3737    function TableCreateIfNotExists(Name: string): TTable;
    3838    function FieldCreateIfNotExists(TableName, FieldName: string; DataType: TDataType): TField;
    39   protected
    4039  public
    4140    procedure Query(Text: string; DbRows: TDbRows = nil); override;
     
    101100  Row.Values.Count := Row.Parent.Fields.Count;
    102101  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;
    104103
    105104  Node2 := Node.FirstChild;
    106105  I := 0;
    107106  while Assigned(Node2) and (Node2.NodeName = 'Value') and (I < Row.Values.Count) do begin
    108     case TField(Row.Parent.Fields[I]).DataType.FieldType of
     107    case Row.Parent.Fields[I].DataType.FieldType of
    109108      ftString: TValueString(Row.Values[I]).Value := string(Node2.TextContent);
    110109      ftInteger: TValueInteger(Row.Values[I]).Value := StrToInt(string(Node2.TextContent));
     
    126125    NewNode := Node.OwnerDocument.CreateElement('Value');
    127126    Node.AppendChild(NewNode);
    128     case TField(Row.Parent.Fields[I]).DataType.FieldType of
     127    case Row.Parent.Fields[I].DataType.FieldType of
    129128      ftString: NewNode.TextContent := UnicodeString(TValueString(Row.Values[I]).Value);
    130129      ftInteger: NewNode.TextContent := UnicodeString(IntToStr(TValueInteger(Row.Values[I]).Value));
     
    160159    NewNode := Node.OwnerDocument.CreateElement('Record');
    161160    Node.AppendChild(NewNode);
    162     SaveNodeRecord(TRecord(Records.Items[I]), NewNode);
     161    SaveNodeRecord(Records[I], NewNode);
    163162  end;
    164163end;
     
    204203    NewNode := Node.OwnerDocument.CreateElement('Field');
    205204    Node.AppendChild(NewNode);
    206     SaveNodeField(TField(Fields.Items[I]), NewNode);
     205    SaveNodeField(Fields[I], NewNode);
    207206  end;
    208207end;
     
    264263    NewNode := Node.OwnerDocument.CreateElement('Table');
    265264    Node.AppendChild(NewNode);
    266     SaveNodeTable(TTable(Tables.Items[I]), NewNode);
     265    SaveNodeTable(Tables[I], NewNode);
    267266  end;
    268267end;
     
    647646  if FileExists(FileName) then
    648647    LoadFromFile(FileName);
    649   (*
     648
     649(*
    650650  TableCreateIfNotExists('Model');
    651651  TableCreateIfNotExists('ModelField');
     
    677677begin
    678678  Tables := TTables.Create;
    679   inherited Create;
     679  inherited;
    680680end;
    681681
    682682destructor TDatabaseXML.Destroy;
    683683begin
    684   Tables.Free;
    685   inherited Destroy;
    686 end;
    687 
     684  FreeAndNil(Tables);
     685  inherited;
     686end;
    688687
    689688end.
Note: See TracChangeset for help on using the changeset viewer.