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);
|
procedure FormCreate(Sender: TObject);
|
||||||
private
|
private
|
||||||
{ Private declarations }
|
{ Private declarations }
|
||||||
FColumns: TTableColumnList;
|
|
||||||
public
|
public
|
||||||
{ Public declarations }
|
{ Public declarations }
|
||||||
end;
|
end;
|
||||||
@ -45,7 +44,6 @@ uses main;
|
|||||||
procedure TColumnSelectionForm.FormCreate(Sender: TObject);
|
procedure TColumnSelectionForm.FormCreate(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
InheritFont(Font);
|
InheritFont(Font);
|
||||||
FColumns := TTableColumnList.Create;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -55,14 +53,9 @@ end;
|
|||||||
procedure TColumnSelectionForm.FormShow(Sender: TObject);
|
procedure TColumnSelectionForm.FormShow(Sender: TObject);
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
KeysDummy: TTableKeyList;
|
|
||||||
ForeignKeysDummy: TForeignKeyList;
|
|
||||||
begin
|
begin
|
||||||
KeysDummy := nil;
|
for i:=0 to Mainform.SelectedTableColumns.Count-1 do
|
||||||
ForeignKeysDummy := nil;
|
chklistColumns.Items.Add(Mainform.SelectedTableColumns[i].Name);
|
||||||
ParseTableStructure(Mainform.SelectedTableCreateStatement, FColumns, KeysDummy, ForeignKeysDummy);
|
|
||||||
for i:=0 to FColumns.Count-1 do
|
|
||||||
chklistColumns.Items.Add(FColumns[i].Name);
|
|
||||||
|
|
||||||
// Check items!
|
// Check items!
|
||||||
if Mainform.FDataGridSelect.Count = 0 then // Simply check all items
|
if Mainform.FDataGridSelect.Count = 0 then // Simply check all items
|
||||||
@ -172,8 +165,8 @@ begin
|
|||||||
// Add all fieldnames again
|
// Add all fieldnames again
|
||||||
chklistColumns.Items.BeginUpdate;
|
chklistColumns.Items.BeginUpdate;
|
||||||
chklistColumns.Clear;
|
chklistColumns.Clear;
|
||||||
for i:=0 to FColumns.Count-1 do
|
for i:=0 to Mainform.SelectedTableColumns.Count-1 do
|
||||||
chklistColumns.Items.Add(FColumns[i].Name);
|
chklistColumns.Items.Add(Mainform.SelectedTableColumns[i].Name);
|
||||||
chklistColumns.Items.EndUpdate;
|
chklistColumns.Items.EndUpdate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -35,7 +35,6 @@ type
|
|||||||
procedure Modified;
|
procedure Modified;
|
||||||
public
|
public
|
||||||
{ Public declarations }
|
{ Public declarations }
|
||||||
FColumns: TTableColumnList;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -55,7 +54,6 @@ procedure TDataSortingForm.FormCreate(Sender: TObject);
|
|||||||
begin
|
begin
|
||||||
InheritFont(Font);
|
InheritFont(Font);
|
||||||
ColumnNames := TStringList.Create;
|
ColumnNames := TStringList.Create;
|
||||||
FColumns := TTableColumnList.Create;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -65,16 +63,11 @@ end;
|
|||||||
procedure TDataSortingForm.FormShow(Sender: TObject);
|
procedure TDataSortingForm.FormShow(Sender: TObject);
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
KeysDummy: TTableKeyList;
|
|
||||||
ForeignKeysDummy: TForeignKeyList;
|
|
||||||
begin
|
begin
|
||||||
// Take column names from listColumns and add here
|
// Take column names from listColumns and add here
|
||||||
KeysDummy := nil;
|
|
||||||
ForeignKeysDummy := nil;
|
|
||||||
ParseTableStructure(Mainform.SelectedTableCreateStatement, FColumns, KeysDummy, ForeignKeysDummy);
|
|
||||||
ColumnNames.Clear;
|
ColumnNames.Clear;
|
||||||
for i:=0 to FColumns.Count-1 do
|
for i:=0 to Mainform.SelectedTableColumns.Count-1 do
|
||||||
ColumnNames.Add(FColumns[i].Name);
|
ColumnNames.Add(Mainform.SelectedTableColumns[i].Name);
|
||||||
|
|
||||||
OrderColumns := Mainform.FDataGridSort;
|
OrderColumns := Mainform.FDataGridSort;
|
||||||
OldOrderClause := ComposeOrderClause(OrderColumns);
|
OldOrderClause := ComposeOrderClause(OrderColumns);
|
||||||
|
Reference in New Issue
Block a user