Ignore:
Timestamp:
Mar 24, 2018, 12:33:48 AM (7 years ago)
Author:
chronos
Message:
  • Modified: Tables creation/deletion using SQL syntax for XML backend.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormFields.pas

    r20 r22  
    9191  if FormField.ShowModal = mrOk then begin
    9292    FormField.Save(NewField);
    93     Fields.Add(NewField);
     93    Fields.Table.DbClient.Query('INSERT INTO ModelField ( Name , TextBefore) VALUES ( ' +
     94      NewField.Name + ' , ' + NewField.TextBefore + ' )');
    9495    ReloadList;
    9596  end else NewField.Free;
     
    107108    if FormField.ShowModal = mrOk then begin
    108109      FormField.Save(TField(ListView1.Selected.Data));
     110      Fields.Table.DbClient.Query('UPDATE ModelField SET TextBefore = ' + TField(ListView1.Selected.Data).TextBefore +
     111        ' WHERE Name = ' + TField(ListView1.Selected.Data).Name);
    109112      ReloadList;
    110113    end;
     
    120123begin
    121124  if Assigned(ListView1.Selected) then begin
    122     Fields.Remove(ListView1.Selected.Data);
     125    Fields.Table.DbClient.Query('DELETE FROM ModelField WHERE Name = ' + TField(ListView1.Selected.Data).Name);
    123126    ReloadList;
    124127    UpdateInterface;
     
    152155
    153156procedure TFormFields.ReloadList;
     157var
     158  DbRows: TDbRows;
     159  NewField: TField;
     160  I: Integer;
    154161begin
     162  DbRows := TDbRows.Create;
     163  Fields.Table.DbClient.Query('SELECT * FROM ModelField WHERE Model = ' + Fields.Table.Name, DbRows);
     164  for I := 0 to DbRows.Count - 1 do begin
     165    NewField := TField.Create;
     166    NewField.Table := Fields.Table;
     167    Fields.Add(NewField);
     168  end;
     169  DbRows.Free;
     170
    155171  ListView1.Items.Count := Fields.Count;
    156172  ListView1.Repaint;
Note: See TracChangeset for help on using the changeset viewer.