mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-26 22:00:16 +08:00
Use the right connection when processing tree node object. Fixes issue #3447.
This commit is contained in:
@ -135,7 +135,7 @@ type
|
|||||||
FObjectSizes, FObjectSizesDone, FObjectSizesDoneExact: Int64;
|
FObjectSizes, FObjectSizesDone, FObjectSizesDoneExact: Int64;
|
||||||
procedure SetToolMode(Value: TToolMode);
|
procedure SetToolMode(Value: TToolMode);
|
||||||
procedure Output(SQL: String; IsEndOfQuery, ForFile, ForDir, ForDb, ForServer: Boolean);
|
procedure Output(SQL: String; IsEndOfQuery, ForFile, ForDir, ForDb, ForServer: Boolean);
|
||||||
procedure AddResults(SQL: String);
|
procedure AddResults(SQL: String; Connection: TDBConnection);
|
||||||
procedure AddNotes(Col1, Col2, Col3, Col4: String);
|
procedure AddNotes(Col1, Col2, Col3, Col4: String);
|
||||||
procedure SetupResultGrid(Results: TDBQuery=nil);
|
procedure SetupResultGrid(Results: TDBQuery=nil);
|
||||||
procedure UpdateResultGrid;
|
procedure UpdateResultGrid;
|
||||||
@ -727,7 +727,7 @@ begin
|
|||||||
if chkChanged.Enabled and chkChanged.Checked then SQL := SQL + ' CHANGED';
|
if chkChanged.Enabled and chkChanged.Checked then SQL := SQL + ' CHANGED';
|
||||||
if chkUseFrm.Enabled and chkUseFrm.Checked then SQL := SQL + ' USE_FRM';
|
if chkUseFrm.Enabled and chkUseFrm.Checked then SQL := SQL + ' USE_FRM';
|
||||||
if chkForUpgrade.Enabled and chkForUpgrade.Checked then SQL := SQL + ' FOR UPGRADE';
|
if chkForUpgrade.Enabled and chkForUpgrade.Checked then SQL := SQL + ' FOR UPGRADE';
|
||||||
AddResults(SQL);
|
AddResults(SQL, DBObj.Connection);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -760,7 +760,7 @@ begin
|
|||||||
SQL := 'SELECT '''+DBObj.Database+''' AS '+DBObj.Connection.QuoteIdent('Database')+', '''+DBObj.Name+''' AS '+DBObj.Connection.QuoteIdent('Table')+', COUNT(*) AS '+DBObj.Connection.QuoteIdent('Found rows')+', '
|
SQL := 'SELECT '''+DBObj.Database+''' AS '+DBObj.Connection.QuoteIdent('Database')+', '''+DBObj.Name+''' AS '+DBObj.Connection.QuoteIdent('Table')+', COUNT(*) AS '+DBObj.Connection.QuoteIdent('Found rows')+', '
|
||||||
+ 'CONCAT(ROUND(100 / '+IntToStr(Max(DBObj.Rows,1))+' * COUNT(*), 1), ''%'') AS '+DBObj.Connection.QuoteIdent('Relevance')+' FROM '+DBObj.QuotedDatabase+'.'+DBObj.QuotedName+' WHERE '
|
+ 'CONCAT(ROUND(100 / '+IntToStr(Max(DBObj.Rows,1))+' * COUNT(*), 1), ''%'') AS '+DBObj.Connection.QuoteIdent('Relevance')+' FROM '+DBObj.QuotedDatabase+'.'+DBObj.QuotedName+' WHERE '
|
||||||
+ SQL;
|
+ SQL;
|
||||||
AddResults(SQL);
|
AddResults(SQL, DBObj.Connection);
|
||||||
end else
|
end else
|
||||||
AddNotes(DBObj.Database, DBObj.Name, f_('%s%s doesn''t have columns of selected type (%s).', [STRSKIPPED, DBObj.ObjType, comboDatatypes.Text]), '');
|
AddNotes(DBObj.Database, DBObj.Name, f_('%s%s doesn''t have columns of selected type (%s).', [STRSKIPPED, DBObj.ObjType, comboDatatypes.Text]), '');
|
||||||
end;
|
end;
|
||||||
@ -789,7 +789,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TfrmTableTools.AddResults(SQL: String);
|
procedure TfrmTableTools.AddResults(SQL: String; Connection: TDBConnection);
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
Row: TStringList;
|
Row: TStringList;
|
||||||
@ -797,7 +797,7 @@ var
|
|||||||
Value: String;
|
Value: String;
|
||||||
begin
|
begin
|
||||||
// Execute query and append results into grid
|
// Execute query and append results into grid
|
||||||
Results := MainForm.ActiveConnection.GetResults(SQL);
|
Results := Connection.GetResults(SQL);
|
||||||
if Results = nil then
|
if Results = nil then
|
||||||
Exit;
|
Exit;
|
||||||
|
|
||||||
@ -1218,6 +1218,7 @@ begin
|
|||||||
esc(DBObj.Name)+' AS '+DBObj.Connection.QuoteIdent('Table')+', ' +
|
esc(DBObj.Name)+' AS '+DBObj.Connection.QuoteIdent('Table')+', ' +
|
||||||
IntToStr(DBObj.Rows)+' AS '+DBObj.Connection.QuoteIdent('Rows')+', '+
|
IntToStr(DBObj.Rows)+' AS '+DBObj.Connection.QuoteIdent('Rows')+', '+
|
||||||
'0 AS '+DBObj.Connection.QuoteIdent('Duration')
|
'0 AS '+DBObj.Connection.QuoteIdent('Duration')
|
||||||
|
, DBObj.Connection
|
||||||
);
|
);
|
||||||
ToFile := (comboExportOutputType.Text = OUTPUT_FILE) or (comboExportOutputType.Text = OUTPUT_FILE_COMPRESSED);
|
ToFile := (comboExportOutputType.Text = OUTPUT_FILE) or (comboExportOutputType.Text = OUTPUT_FILE_COMPRESSED);
|
||||||
ToDir := comboExportOutputType.Text = OUTPUT_DIR;
|
ToDir := comboExportOutputType.Text = OUTPUT_DIR;
|
||||||
@ -1556,6 +1557,7 @@ begin
|
|||||||
esc(DBObj.Name)+' AS '+DBObj.Connection.QuoteIdent('Table')+', ' +
|
esc(DBObj.Name)+' AS '+DBObj.Connection.QuoteIdent('Table')+', ' +
|
||||||
esc('Updating...')+' AS '+DBObj.Connection.QuoteIdent('Operation')+', '+
|
esc('Updating...')+' AS '+DBObj.Connection.QuoteIdent('Operation')+', '+
|
||||||
''''' AS '+DBObj.Connection.QuoteIdent('Result')
|
''''' AS '+DBObj.Connection.QuoteIdent('Result')
|
||||||
|
, DBObj.Connection
|
||||||
);
|
);
|
||||||
Specs := TStringList.Create;
|
Specs := TStringList.Create;
|
||||||
if chkBulkTableEditDatabase.Checked and (comboBulkTableEditDatabase.Text <> DBObj.Database) then begin
|
if chkBulkTableEditDatabase.Checked and (comboBulkTableEditDatabase.Text <> DBObj.Database) then begin
|
||||||
|
Reference in New Issue
Block a user