mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-14 10:02:10 +08:00
Support query timeout on MSSQL and PostgreSQL. Make customizable per up/down scroller in "Advanced" tab of session manager. Fixes issue #3507.
This commit is contained in:
@ -617,6 +617,13 @@ object connform: Tconnform
|
|||||||
Caption = 'Startup script:'
|
Caption = 'Startup script:'
|
||||||
FocusControl = editStartupScript
|
FocusControl = editStartupScript
|
||||||
end
|
end
|
||||||
|
object lblQueryTimeout: TLabel
|
||||||
|
Left = 3
|
||||||
|
Top = 183
|
||||||
|
Width = 73
|
||||||
|
Height = 13
|
||||||
|
Caption = 'Query timeout:'
|
||||||
|
end
|
||||||
object editSSLPrivateKey: TButtonedEdit
|
object editSSLPrivateKey: TButtonedEdit
|
||||||
Left = 120
|
Left = 120
|
||||||
Top = 36
|
Top = 36
|
||||||
@ -671,7 +678,7 @@ object connform: Tconnform
|
|||||||
end
|
end
|
||||||
object chkLocalTimeZone: TCheckBox
|
object chkLocalTimeZone: TCheckBox
|
||||||
Left = 120
|
Left = 120
|
||||||
Top = 180
|
Top = 212
|
||||||
Width = 172
|
Width = 172
|
||||||
Height = 17
|
Height = 17
|
||||||
Hint =
|
Hint =
|
||||||
@ -679,7 +686,7 @@ object connform: Tconnform
|
|||||||
', for MySQL 4.1.3+'
|
', for MySQL 4.1.3+'
|
||||||
Anchors = [akLeft, akTop, akRight]
|
Anchors = [akLeft, akTop, akRight]
|
||||||
Caption = 'Use own client time zone'
|
Caption = 'Use own client time zone'
|
||||||
TabOrder = 5
|
TabOrder = 7
|
||||||
OnClick = Modification
|
OnClick = Modification
|
||||||
end
|
end
|
||||||
object editStartupScript: TButtonedEdit
|
object editStartupScript: TButtonedEdit
|
||||||
@ -698,7 +705,7 @@ object connform: Tconnform
|
|||||||
end
|
end
|
||||||
object chkFullTableStatus: TCheckBox
|
object chkFullTableStatus: TCheckBox
|
||||||
Left = 120
|
Left = 120
|
||||||
Top = 203
|
Top = 235
|
||||||
Width = 172
|
Width = 172
|
||||||
Height = 17
|
Height = 17
|
||||||
Hint =
|
Hint =
|
||||||
@ -706,9 +713,29 @@ object connform: Tconnform
|
|||||||
'DB tables'
|
'DB tables'
|
||||||
Anchors = [akLeft, akTop, akRight]
|
Anchors = [akLeft, akTop, akRight]
|
||||||
Caption = 'Get full table status'
|
Caption = 'Get full table status'
|
||||||
TabOrder = 6
|
TabOrder = 8
|
||||||
OnClick = Modification
|
OnClick = Modification
|
||||||
end
|
end
|
||||||
|
object editQueryTimeout: TEdit
|
||||||
|
Left = 120
|
||||||
|
Top = 180
|
||||||
|
Width = 90
|
||||||
|
Height = 21
|
||||||
|
NumbersOnly = True
|
||||||
|
TabOrder = 5
|
||||||
|
Text = '0'
|
||||||
|
OnChange = Modification
|
||||||
|
end
|
||||||
|
object updownQueryTimeout: TUpDown
|
||||||
|
Left = 210
|
||||||
|
Top = 180
|
||||||
|
Width = 16
|
||||||
|
Height = 21
|
||||||
|
Associate = editQueryTimeout
|
||||||
|
Max = 2147483646
|
||||||
|
TabOrder = 6
|
||||||
|
Wrap = True
|
||||||
|
end
|
||||||
end
|
end
|
||||||
object tabStatistics: TTabSheet
|
object tabStatistics: TTabSheet
|
||||||
Caption = 'Statistics'
|
Caption = 'Statistics'
|
||||||
|
@ -102,6 +102,9 @@ type
|
|||||||
Importsettingsfile1: TMenuItem;
|
Importsettingsfile1: TMenuItem;
|
||||||
lblComment: TLabel;
|
lblComment: TLabel;
|
||||||
memoComment: TMemo;
|
memoComment: TMemo;
|
||||||
|
lblQueryTimeout: TLabel;
|
||||||
|
editQueryTimeout: TEdit;
|
||||||
|
updownQueryTimeout: TUpDown;
|
||||||
procedure FormCreate(Sender: TObject);
|
procedure FormCreate(Sender: TObject);
|
||||||
procedure btnOpenClick(Sender: TObject);
|
procedure btnOpenClick(Sender: TObject);
|
||||||
procedure FormShow(Sender: TObject);
|
procedure FormShow(Sender: TObject);
|
||||||
@ -317,6 +320,7 @@ begin
|
|||||||
Sess.Port := updownPort.Position;
|
Sess.Port := updownPort.Position;
|
||||||
Sess.NetType := TNetType(comboNetType.ItemIndex);
|
Sess.NetType := TNetType(comboNetType.ItemIndex);
|
||||||
Sess.Compressed := chkCompressed.Checked;
|
Sess.Compressed := chkCompressed.Checked;
|
||||||
|
Sess.QueryTimeout := updownQueryTimeout.Position;
|
||||||
Sess.LocalTimeZone := chkLocalTimeZone.Checked;
|
Sess.LocalTimeZone := chkLocalTimeZone.Checked;
|
||||||
Sess.FullTableStatus := chkFullTableStatus.Checked;
|
Sess.FullTableStatus := chkFullTableStatus.Checked;
|
||||||
Sess.AllDatabasesStr := editDatabases.Text;
|
Sess.AllDatabasesStr := editDatabases.Text;
|
||||||
@ -526,6 +530,7 @@ begin
|
|||||||
Result.SSLCACertificate := editSSLCACertificate.Text;
|
Result.SSLCACertificate := editSSLCACertificate.Text;
|
||||||
Result.StartupScriptFilename := editStartupScript.Text;
|
Result.StartupScriptFilename := editStartupScript.Text;
|
||||||
Result.Compressed := chkCompressed.Checked;
|
Result.Compressed := chkCompressed.Checked;
|
||||||
|
Result.QueryTimeout := updownQueryTimeout.Position;
|
||||||
Result.LocalTimeZone := chkLocalTimeZone.Checked;
|
Result.LocalTimeZone := chkLocalTimeZone.Checked;
|
||||||
Result.FullTableStatus := chkFullTableStatus.Checked;
|
Result.FullTableStatus := chkFullTableStatus.Checked;
|
||||||
end;
|
end;
|
||||||
@ -765,6 +770,7 @@ begin
|
|||||||
chkWindowsAuth.Checked := Sess.WindowsAuth;
|
chkWindowsAuth.Checked := Sess.WindowsAuth;
|
||||||
updownPort.Position := Sess.Port;
|
updownPort.Position := Sess.Port;
|
||||||
chkCompressed.Checked := Sess.Compressed;
|
chkCompressed.Checked := Sess.Compressed;
|
||||||
|
updownQueryTimeout.Position := Sess.QueryTimeout;
|
||||||
chkLocalTimeZone.Checked := Sess.LocalTimeZone;
|
chkLocalTimeZone.Checked := Sess.LocalTimeZone;
|
||||||
chkFullTableStatus.Checked := Sess.FullTableStatus;
|
chkFullTableStatus.Checked := Sess.FullTableStatus;
|
||||||
editDatabases.Text := Sess.AllDatabasesStr;
|
editDatabases.Text := Sess.AllDatabasesStr;
|
||||||
@ -1010,6 +1016,7 @@ begin
|
|||||||
or (Sess.WindowsAuth <> chkWindowsAuth.Checked)
|
or (Sess.WindowsAuth <> chkWindowsAuth.Checked)
|
||||||
or (Sess.Port <> updownPort.Position)
|
or (Sess.Port <> updownPort.Position)
|
||||||
or (Sess.Compressed <> chkCompressed.Checked)
|
or (Sess.Compressed <> chkCompressed.Checked)
|
||||||
|
or (Sess.QueryTimeout <> updownQueryTimeout.Position)
|
||||||
or (Sess.LocalTimeZone <> chkLocalTimeZone.Checked)
|
or (Sess.LocalTimeZone <> chkLocalTimeZone.Checked)
|
||||||
or (Sess.FullTableStatus <> chkFullTableStatus.Checked)
|
or (Sess.FullTableStatus <> chkFullTableStatus.Checked)
|
||||||
or (Sess.NetType <> TNetType(comboNetType.ItemIndex))
|
or (Sess.NetType <> TNetType(comboNetType.ItemIndex))
|
||||||
@ -1098,6 +1105,9 @@ begin
|
|||||||
lblSSLCertificate.Enabled := Params.WantSSL;
|
lblSSLCertificate.Enabled := Params.WantSSL;
|
||||||
editSSLCertificate.Enabled := Params.WantSSL;
|
editSSLCertificate.Enabled := Params.WantSSL;
|
||||||
tabSSHtunnel.TabVisible := Params.NetType = ntMySQL_SSHtunnel;
|
tabSSHtunnel.TabVisible := Params.NetType = ntMySQL_SSHtunnel;
|
||||||
|
lblQueryTimeout.Enabled := Params.NetTypeGroup in [ngMSSQL, ngPgSQL];
|
||||||
|
editQueryTimeout.Enabled := lblQueryTimeout.Enabled;
|
||||||
|
updownQueryTimeout.Enabled := lblQueryTimeout.Enabled;
|
||||||
Params.Free;
|
Params.Free;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -205,7 +205,7 @@ type
|
|||||||
FHostname, FUsername, FPassword, FAllDatabases, FComment, FStartupScriptFilename,
|
FHostname, FUsername, FPassword, FAllDatabases, FComment, FStartupScriptFilename,
|
||||||
FSessionPath, FSSLPrivateKey, FSSLCertificate, FSSLCACertificate, FServerVersion,
|
FSessionPath, FSSLPrivateKey, FSSLCertificate, FSSLCACertificate, FServerVersion,
|
||||||
FSSHHost, FSSHUser, FSSHPassword, FSSHPlinkExe, FSSHPrivateKey: String;
|
FSSHHost, FSSHUser, FSSHPassword, FSSHPlinkExe, FSSHPrivateKey: String;
|
||||||
FPort, FSSHPort, FSSHLocalPort, FSSHTimeout, FCounter: Integer;
|
FPort, FSSHPort, FSSHLocalPort, FSSHTimeout, FCounter, FQueryTimeout: Integer;
|
||||||
FLoginPrompt, FCompressed, FLocalTimeZone, FFullTableStatus, FWindowsAuth, FWantSSL, FIsFolder: Boolean;
|
FLoginPrompt, FCompressed, FLocalTimeZone, FFullTableStatus, FWindowsAuth, FWantSSL, FIsFolder: Boolean;
|
||||||
FSessionColor: TColor;
|
FSessionColor: TColor;
|
||||||
FLastConnect: TDateTime;
|
FLastConnect: TDateTime;
|
||||||
@ -246,6 +246,7 @@ type
|
|||||||
property AllDatabasesStr: String read FAllDatabases write FAllDatabases;
|
property AllDatabasesStr: String read FAllDatabases write FAllDatabases;
|
||||||
property Comment: String read FComment write FComment;
|
property Comment: String read FComment write FComment;
|
||||||
property StartupScriptFilename: String read FStartupScriptFilename write FStartupScriptFilename;
|
property StartupScriptFilename: String read FStartupScriptFilename write FStartupScriptFilename;
|
||||||
|
property QueryTimeout: Integer read FQueryTimeout write FQueryTimeout;
|
||||||
property Compressed: Boolean read FCompressed write FCompressed;
|
property Compressed: Boolean read FCompressed write FCompressed;
|
||||||
property LocalTimeZone: Boolean read FLocalTimeZone write FLocalTimeZone;
|
property LocalTimeZone: Boolean read FLocalTimeZone write FLocalTimeZone;
|
||||||
property FullTableStatus: Boolean read FFullTableStatus write FFullTableStatus;
|
property FullTableStatus: Boolean read FFullTableStatus write FFullTableStatus;
|
||||||
@ -1099,6 +1100,7 @@ begin
|
|||||||
FSSLCACertificate := AppSettings.ReadString(asSSLCA);
|
FSSLCACertificate := AppSettings.ReadString(asSSLCA);
|
||||||
FStartupScriptFilename := AppSettings.ReadString(asStartupScriptFilename);
|
FStartupScriptFilename := AppSettings.ReadString(asStartupScriptFilename);
|
||||||
FCompressed := AppSettings.ReadBool(asCompressed);
|
FCompressed := AppSettings.ReadBool(asCompressed);
|
||||||
|
FQueryTimeout := AppSettings.ReadInt(asQueryTimeout);
|
||||||
FLocalTimeZone := AppSettings.ReadBool(asLocalTimeZone);
|
FLocalTimeZone := AppSettings.ReadBool(asLocalTimeZone);
|
||||||
FFullTableStatus := AppSettings.ReadBool(asFullTableStatus);
|
FFullTableStatus := AppSettings.ReadBool(asFullTableStatus);
|
||||||
FServerVersion := AppSettings.ReadString(asServerVersionFull);
|
FServerVersion := AppSettings.ReadString(asServerVersionFull);
|
||||||
@ -1132,6 +1134,7 @@ begin
|
|||||||
AppSettings.WriteInt(asNetType, Integer(FNetType));
|
AppSettings.WriteInt(asNetType, Integer(FNetType));
|
||||||
AppSettings.WriteBool(asCompressed, FCompressed);
|
AppSettings.WriteBool(asCompressed, FCompressed);
|
||||||
AppSettings.WriteBool(asLocalTimeZone, FLocalTimeZone);
|
AppSettings.WriteBool(asLocalTimeZone, FLocalTimeZone);
|
||||||
|
AppSettings.WriteInt(asQueryTimeout, FQueryTimeout);
|
||||||
AppSettings.WriteBool(asFullTableStatus, FFullTableStatus);
|
AppSettings.WriteBool(asFullTableStatus, FFullTableStatus);
|
||||||
AppSettings.WriteString(asDatabases, FAllDatabases);
|
AppSettings.WriteString(asDatabases, FAllDatabases);
|
||||||
AppSettings.WriteString(asComment, FComment);
|
AppSettings.WriteString(asComment, FComment);
|
||||||
@ -1710,6 +1713,7 @@ begin
|
|||||||
// CurCharset := CharacterSet;
|
// CurCharset := CharacterSet;
|
||||||
// Log(lcDebug, 'Characterset: '+CurCharset);
|
// Log(lcDebug, 'Characterset: '+CurCharset);
|
||||||
FIsUnicode := True;
|
FIsUnicode := True;
|
||||||
|
FAdoHandle.CommandTimeout := Parameters.QueryTimeout;
|
||||||
try
|
try
|
||||||
// Gracefully accept failure on MS Azure (SQL Server 11), which does not have a sysprocesses table
|
// Gracefully accept failure on MS Azure (SQL Server 11), which does not have a sysprocesses table
|
||||||
FServerUptime := StrToIntDef(GetVar('SELECT DATEDIFF(SECOND, '+QuoteIdent('login_time')+', CURRENT_TIMESTAMP) FROM '+QuoteIdent('master')+'.'+QuoteIdent('dbo')+'.'+QuoteIdent('sysprocesses')+' WHERE '+QuoteIdent('spid')+'=1'), -1);
|
FServerUptime := StrToIntDef(GetVar('SELECT DATEDIFF(SECOND, '+QuoteIdent('login_time')+', CURRENT_TIMESTAMP) FROM '+QuoteIdent('master')+'.'+QuoteIdent('dbo')+'.'+QuoteIdent('sysprocesses')+' WHERE '+QuoteIdent('spid')+'=1'), -1);
|
||||||
@ -1802,6 +1806,7 @@ begin
|
|||||||
FConnectionStarted := GetTickCount div 1000;
|
FConnectionStarted := GetTickCount div 1000;
|
||||||
Log(lcInfo, f_('Connected. Thread-ID: %d', [ThreadId]));
|
Log(lcInfo, f_('Connected. Thread-ID: %d', [ThreadId]));
|
||||||
FIsUnicode := True;
|
FIsUnicode := True;
|
||||||
|
Query('SET statement_timeout TO '+IntToStr(Parameters.QueryTimeout));
|
||||||
try
|
try
|
||||||
FServerUptime := StrToIntDef(GetVar('SELECT EXTRACT(EPOCH FROM CURRENT_TIMESTAMP - pg_postmaster_start_time())::INTEGER'), -1);
|
FServerUptime := StrToIntDef(GetVar('SELECT EXTRACT(EPOCH FROM CURRENT_TIMESTAMP - pg_postmaster_start_time())::INTEGER'), -1);
|
||||||
except
|
except
|
||||||
|
@ -140,7 +140,7 @@ type
|
|||||||
asUser, asPassword, asWindowsAuth, asLoginPrompt, asPort,
|
asUser, asPassword, asWindowsAuth, asLoginPrompt, asPort,
|
||||||
asPlinkExecutable, asSSHtunnelHost, asSSHtunnelHostPort, asSSHtunnelPort, asSSHtunnelUser,
|
asPlinkExecutable, asSSHtunnelHost, asSSHtunnelHostPort, asSSHtunnelPort, asSSHtunnelUser,
|
||||||
asSSHtunnelPassword, asSSHtunnelTimeout, asSSHtunnelPrivateKey, asSSLActive, asSSLKey,
|
asSSHtunnelPassword, asSSHtunnelTimeout, asSSHtunnelPrivateKey, asSSLActive, asSSLKey,
|
||||||
asSSLCert, asSSLCA, asNetType, asCompressed, asLocalTimeZone,
|
asSSLCert, asSSLCA, asNetType, asCompressed, asLocalTimeZone, asQueryTimeout,
|
||||||
asStartupScriptFilename, asDatabases, asComment, asDatabaseFilter, asTableFilter, asExportSQLCreateDatabases,
|
asStartupScriptFilename, asDatabases, asComment, asDatabaseFilter, asTableFilter, asExportSQLCreateDatabases,
|
||||||
asExportSQLCreateTables, asExportSQLDataHow, asExportSQLFilenames, asExportZIPFilenames, asExportSQLDirectories,
|
asExportSQLCreateTables, asExportSQLDataHow, asExportSQLFilenames, asExportZIPFilenames, asExportSQLDirectories,
|
||||||
asExportSQLDatabase, asExportSQLServerDatabase, asExportSQLOutput, asGridExportOutputCopy, asGridExportOutputFile,
|
asExportSQLDatabase, asExportSQLServerDatabase, asExportSQLOutput, asGridExportOutputCopy, asGridExportOutputFile,
|
||||||
@ -3123,6 +3123,7 @@ begin
|
|||||||
InitSetting(asNetType, 'NetType', Integer(ntMySQL_TCPIP), False, '', True);
|
InitSetting(asNetType, 'NetType', Integer(ntMySQL_TCPIP), False, '', True);
|
||||||
InitSetting(asCompressed, 'Compressed', 0, False, '', True);
|
InitSetting(asCompressed, 'Compressed', 0, False, '', True);
|
||||||
InitSetting(asLocalTimeZone, 'LocalTimeZone', 0, False, '', True);
|
InitSetting(asLocalTimeZone, 'LocalTimeZone', 0, False, '', True);
|
||||||
|
InitSetting(asQueryTimeout, 'QueryTimeout', 30, False, '', True);
|
||||||
InitSetting(asStartupScriptFilename, 'StartupScriptFilename', 0, False, '', True);
|
InitSetting(asStartupScriptFilename, 'StartupScriptFilename', 0, False, '', True);
|
||||||
InitSetting(asDatabases, 'Databases', 0, False, '', True);
|
InitSetting(asDatabases, 'Databases', 0, False, '', True);
|
||||||
InitSetting(asComment, 'Comment', 0, False, '', True);
|
InitSetting(asComment, 'Comment', 0, False, '', True);
|
||||||
|
Reference in New Issue
Block a user