File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -71,6 +71,8 @@ TTableColumnList = class(TObjectList<TTableColumn>)
7171 public
7272 procedure Assign (Source: TTableColumnList);
7373 function FindByName (const Value : String): TTableColumn;
74+ function HasInvisibleColumns : Boolean;
75+ function QuoteIdents : String;
7476 end ;
7577 TColumnCache = TDictionary<String,TTableColumnList>;
7678
@@ -10876,6 +10878,31 @@ function TTableColumnList.FindByName(const Value: String): TTableColumn;
1087610878 end ;
1087710879end ;
1087810880
10881+ function TTableColumnList.HasInvisibleColumns : Boolean;
10882+ var
10883+ Col: TTableColumn;
10884+ begin
10885+ Result := False;
10886+ for Col in Self do begin
10887+ if Col.Invisible then begin
10888+ Result := True;
10889+ Break;
10890+ end ;
10891+ end ;
10892+ end ;
10893+
10894+ function TTableColumnList.QuoteIdents : String;
10895+ var
10896+ Col: TTableColumn;
10897+ QuotedNames: TStringList;
10898+ begin
10899+ QuotedNames := TStringList.Create;
10900+ for Col in Self do begin
10901+ QuotedNames.Add(Col.Connection.QuoteIdent(Col.Name ));
10902+ end ;
10903+ Result := Implode(' , ' , QuotedNames);
10904+ QuotedNames.Free;
10905+ end ;
1087910906
1088010907
1088110908{ *** TTableKey }
Original file line number Diff line number Diff line change @@ -1767,7 +1767,7 @@ procedure TfrmTableTools.DoExport(DBObj: TDBObject);
17671767 KeyList: TTableKeyList;
17681768 Column: TTableColumn;
17691769 Quoter: TDBConnection;
1770- TargetFileName, SetCharsetCode: String;
1770+ TargetFileName, SetCharsetCode, ColumnsForSelect : String;
17711771 OrderBy: String;
17721772const
17731773 TempDelim = ' //' ;
@@ -2049,8 +2049,13 @@ procedure TfrmTableTools.DoExport(DBObj: TDBObject);
20492049 TargetDbAndObject := Quoter.QuoteIdent(FinalDbName) + ' .' + TargetDbAndObject;
20502050 Offset := 0 ;
20512051 RowCount := 0 ;
2052- // Sort by primary key if one exists, see issue #2168
2052+ // Examine columns
20532053 ColumnList := DBObj.TableColumns;
2054+ if not ColumnList.HasInvisibleColumns then
2055+ ColumnsForSelect := ' *'
2056+ else
2057+ ColumnsForSelect := ColumnList.QuoteIdents;
2058+ // Sort by primary key if one exists, see issue #2168
20542059 KeyList := DBObj.TableKeys;
20552060 KeyColumns := DBObj.Connection.GetKeyColumns(ColumnList, KeyList);
20562061 OrderBy := ' ' ;
@@ -2073,7 +2078,7 @@ procedure TfrmTableTools.DoExport(DBObj: TDBObject);
20732078 Data := DBObj.Connection.GetResults(
20742079 DBObj.Connection.ApplyLimitClause(
20752080 ' SELECT' ,
2076- ' /* ' +APPNAME+' ' +MainForm.AppVersion+' */ * FROM ' +DBObj.QuotedDbAndTableName + OrderBy,
2081+ ' /* ' +APPNAME+' ' +MainForm.AppVersion+' */ ' + ColumnsForSelect + ' FROM ' +DBObj.QuotedDbAndTableName + OrderBy,
20772082 Limit,
20782083 Offset)
20792084 );
You can’t perform that action at this time.
0 commit comments