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/UFormTables.pas

    r21 r22  
    119119  if FormTable.ShowModal = mrOk then begin
    120120    FormTable.Save(NewTable);
    121     Tables.DbClient.Query('CREATE TABLE ' + NewTable.Name + ' (ID INTEGER)');
     121    Tables.DbClient.Query('INSERT INTO Model ( Name , Caption ) VALUES ( ' +
     122      NewTable.Name + ' , ' + NewTable.Caption + ' )');
    122123    ReloadList;
    123124  end else NewTable.Free;
     
    130131    if FormTable.ShowModal = mrOk then begin
    131132      FormTable.Save(TTable(ListView1.Selected.Data));
     133      DbClient.Query('UPDATE Model SET Name = ' + TTable(ListView1.Selected.Data).Name);
    132134      ReloadList;
    133135    end;
     
    138140begin
    139141  if Assigned(ListView1.Selected) then begin
    140     if MessageDlg(SRemoveTable, Format(SRemoveTableConfirm, [TTable(ListView1.Selected.Data).Name]),
     142    if MessageDlg(SRemoveTable, Format(SRemoveTableConfirm, [TTable(ListView1.Selected.Data).Caption]),
    141143    mtConfirmation, [mbYes, mbNo], 0) = mrYes then begin
    142       Tables.DbClient.Query('DROP TABLE ' + TTable(ListView1.Selected.Data).Name);
     144      Tables.DbClient.Query('DELETE FROM Model WHERE Name = ' + TTable(ListView1.Selected.Data).Name);
    143145      ReloadList;
    144146    end;
     
    175177      end;
    176178      for C := 0 to FormFields.Fields.Count - 1 do begin
    177         OldField := OldTable.Fields.FindByName(TField(FormFields.Fields[C]).Name);
     179        OldField := OldTable.Fields.SearchByName(TField(FormFields.Fields[C]).Name);
    178180        if Assigned(OldField) then begin
    179181          FI := OldTable.Fields.IndexOf(OldField);
     
    210212procedure TFormTables.FormCreate(Sender: TObject);
    211213begin
    212   FTables := TTables.Create;
     214  FTables := TTables.Create(False);
    213215end;
    214216
Note: See TracChangeset for help on using the changeset viewer.