Skip to content
Permalink
Browse files

Issue #12: Implement TDBConnection.GetTableColumns and .GetTableKeys …

…(todo: .GetTableForeignKeys), as a replacement for the error prone ParseTableStructure. SQLite columns and keys should be parsed correctly now, MS SQL and PostgreSQL may now have some glitches to fix.
  • Loading branch information
ansgarbecker committed Jan 8, 2020
1 parent 0d0c6df commit b45a0d57c734daccaa5df3a0be6006ffda39d71d
Showing with 430 additions and 114 deletions.
  1. +9 −8 source/copytable.pas
  2. +384 −77 source/dbconnection.pas
  3. +1 −2 source/insertfiles.pas
  4. +1 −1 source/loaddata.pas
  5. +29 −20 source/main.pas
  6. +5 −5 source/table_editor.pas
  7. +1 −1 source/tabletools.pas
@@ -72,9 +72,6 @@ procedure TCopyTableForm.FormCreate(Sender: TObject);
Height := AppSettings.ReadInt(asCopyTableWindowHeight);
MainForm.SetupSynEditors;
FixVT(TreeElements);
FColumns := TTableColumnList.Create;
FKeys := TTableKeyList.Create;
FForeignKeys := TForeignKeyList.Create;
end;


@@ -129,12 +126,16 @@ procedure TCopyTableForm.FormShow(Sender: TObject);
comboDatabase.ItemIndex := 0;

// Fetch columns and key structures from table or view
FColumns.Clear;
FKeys.Clear;
FForeignKeys.Clear;
case FDBObj.NodeType of
lntTable: FConnection.ParseTableStructure(FDBObj.CreateCode, FColumns, FKeys, FForeignKeys);
lntView: FConnection.ParseViewStructure(FDBObj.CreateCode, FDBObj, FColumns, Dummy, Dummy, Dummy, Dummy, Dummy);
lntTable: begin
FColumns := FDBObj.TableColumns;
FKeys := FDBObj.TableKeys;
FForeignKeys := FDBObj.TableForeignKeys;
end;
lntView: begin
FColumns := TTableColumnList.Create;
FConnection.ParseViewStructure(FDBObj.CreateCode, FDBObj, FColumns, Dummy, Dummy, Dummy, Dummy, Dummy);
end
else raise Exception.CreateFmt(_('Neither table nor view: %s'), [FDBObj.Name]);
end;

0 comments on commit b45a0d5

Please sign in to comment.
You can’t perform that action at this time.