mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-06 18:24:26 +08:00
Columns of selected datagrid object can also come from a view, so ParseTableStructure is not sufficient in both data sorting and column selection forms. Instead, just use mainform's lists which are exactly what we need. Fixes issue #1611.
This commit is contained in:
@ -25,7 +25,6 @@ type
|
||||
procedure FormCreate(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
FColumns: TTableColumnList;
|
||||
public
|
||||
{ Public declarations }
|
||||
end;
|
||||
@ -45,7 +44,6 @@ uses main;
|
||||
procedure TColumnSelectionForm.FormCreate(Sender: TObject);
|
||||
begin
|
||||
InheritFont(Font);
|
||||
FColumns := TTableColumnList.Create;
|
||||
end;
|
||||
|
||||
|
||||
@ -55,14 +53,9 @@ end;
|
||||
procedure TColumnSelectionForm.FormShow(Sender: TObject);
|
||||
var
|
||||
i: Integer;
|
||||
KeysDummy: TTableKeyList;
|
||||
ForeignKeysDummy: TForeignKeyList;
|
||||
begin
|
||||
KeysDummy := nil;
|
||||
ForeignKeysDummy := nil;
|
||||
ParseTableStructure(Mainform.SelectedTableCreateStatement, FColumns, KeysDummy, ForeignKeysDummy);
|
||||
for i:=0 to FColumns.Count-1 do
|
||||
chklistColumns.Items.Add(FColumns[i].Name);
|
||||
for i:=0 to Mainform.SelectedTableColumns.Count-1 do
|
||||
chklistColumns.Items.Add(Mainform.SelectedTableColumns[i].Name);
|
||||
|
||||
// Check items!
|
||||
if Mainform.FDataGridSelect.Count = 0 then // Simply check all items
|
||||
@ -172,8 +165,8 @@ begin
|
||||
// Add all fieldnames again
|
||||
chklistColumns.Items.BeginUpdate;
|
||||
chklistColumns.Clear;
|
||||
for i:=0 to FColumns.Count-1 do
|
||||
chklistColumns.Items.Add(FColumns[i].Name);
|
||||
for i:=0 to Mainform.SelectedTableColumns.Count-1 do
|
||||
chklistColumns.Items.Add(Mainform.SelectedTableColumns[i].Name);
|
||||
chklistColumns.Items.EndUpdate;
|
||||
end;
|
||||
|
||||
|
@ -35,7 +35,6 @@ type
|
||||
procedure Modified;
|
||||
public
|
||||
{ Public declarations }
|
||||
FColumns: TTableColumnList;
|
||||
end;
|
||||
|
||||
|
||||
@ -55,7 +54,6 @@ procedure TDataSortingForm.FormCreate(Sender: TObject);
|
||||
begin
|
||||
InheritFont(Font);
|
||||
ColumnNames := TStringList.Create;
|
||||
FColumns := TTableColumnList.Create;
|
||||
end;
|
||||
|
||||
|
||||
@ -65,16 +63,11 @@ end;
|
||||
procedure TDataSortingForm.FormShow(Sender: TObject);
|
||||
var
|
||||
i: Integer;
|
||||
KeysDummy: TTableKeyList;
|
||||
ForeignKeysDummy: TForeignKeyList;
|
||||
begin
|
||||
// Take column names from listColumns and add here
|
||||
KeysDummy := nil;
|
||||
ForeignKeysDummy := nil;
|
||||
ParseTableStructure(Mainform.SelectedTableCreateStatement, FColumns, KeysDummy, ForeignKeysDummy);
|
||||
ColumnNames.Clear;
|
||||
for i:=0 to FColumns.Count-1 do
|
||||
ColumnNames.Add(FColumns[i].Name);
|
||||
for i:=0 to Mainform.SelectedTableColumns.Count-1 do
|
||||
ColumnNames.Add(Mainform.SelectedTableColumns[i].Name);
|
||||
|
||||
OrderColumns := Mainform.FDataGridSort;
|
||||
OldOrderClause := ComposeOrderClause(OrderColumns);
|
||||
|
Reference in New Issue
Block a user